Skip to content

Commit c6b5cea

Browse files
bpo-45269: test wrong markers type to c_make_encoder (GH-28540) (GH-28610)
(cherry picked from commit e046aab) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
1 parent 68223cd commit c6b5cea

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Lib/test/test_json/test_speedups.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ def bad_encoder2(*args):
5959
with self.assertRaises(ZeroDivisionError):
6060
enc('spam', 4)
6161

62+
def test_bad_markers_argument_to_encoder(self):
63+
# https://bugs.python.org/issue45269
64+
with self.assertRaisesRegex(
65+
TypeError,
66+
r'make_encoder\(\) argument 1 must be dict or None, not int',
67+
):
68+
self.json.encoder.c_make_encoder(1, None, None, None, ': ', ', ',
69+
False, False, False)
70+
6271
def test_bad_bool_args(self):
6372
def test(name):
6473
self.json.encoder.JSONEncoder(**{name: BadBool()}).encode({'a': 1})
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Cover case when invalid ``markers`` type is supplied to ``c_make_encoder``.

0 commit comments

Comments
 (0)