diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-05-03 02:37:13 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-05-03 02:37:13 (GMT) |
commit | 88abdef02b33774e7d675a7cc47a9b2567a41921 (patch) | |
tree | 39002cc8696adb52a8e454c470f528b8d34901f4 /Lib/test/test_json | |
parent | c9083bf1a14d9949c07804123712d2a18566fe62 (diff) | |
parent | 122f4b1bda8262ace6aa021935e8c605a17c3748 (diff) | |
download | cpython-88abdef02b33774e7d675a7cc47a9b2567a41921.zip cpython-88abdef02b33774e7d675a7cc47a9b2567a41921.tar.gz cpython-88abdef02b33774e7d675a7cc47a9b2567a41921.tar.bz2 |
merge 3.4 (#24094)
Diffstat (limited to 'Lib/test/test_json')
-rw-r--r-- | Lib/test/test_json/test_dump.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_json/test_dump.py b/Lib/test/test_json/test_dump.py index af19258..fd0d86b 100644 --- a/Lib/test/test_json/test_dump.py +++ b/Lib/test/test_json/test_dump.py @@ -28,6 +28,25 @@ class TestDump: self.assertEqual(self.dumps(a, default=crasher), '[null, null, null, null, null]') + # Issue 24094 + def test_encode_evil_dict(self): + class D(dict): + def keys(self): + return L + + class X: + def __hash__(self): + del L[0] + return 1337 + + def __lt__(self, o): + return 0 + + L = [X() for i in range(1122)] + d = D() + d[1337] = "true.dat" + self.assertEqual(self.dumps(d, sort_keys=True), '{"1337": "true.dat"}') + class TestPyDump(TestDump, PyTest): pass |