Skip to content

Commit e046aab

Browse files
authored
bpo-45269: test wrong markers type to c_make_encoder (GH-28540)
1 parent 4f05f15 commit e046aab

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Lib/test/test_json/test_speedups.py

+9
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})
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)