diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-07-16 04:50:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-16 04:50:37 (GMT) |
commit | 45c471c04553d7e4cb5c328ea1ab02d6716f2bab (patch) | |
tree | 1637296f0ce39113ab7d829d3e39660fd5430aa2 /Lib | |
parent | ada3f31365d0634d0cd8eeacfacd98291e34a8cc (diff) | |
download | cpython-45c471c04553d7e4cb5c328ea1ab02d6716f2bab.zip cpython-45c471c04553d7e4cb5c328ea1ab02d6716f2bab.tar.gz cpython-45c471c04553d7e4cb5c328ea1ab02d6716f2bab.tar.bz2 |
[3.5] bpo-30936: Fix a reference leak in json when fail to sort keys. (GH-2712). (#2728)
(cherry picked from commit 49f6449ef4b81537c19b82329caaf60596c516c2)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_json/test_speedups.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_json/test_speedups.py b/Lib/test/test_json/test_speedups.py index 8d98ab5..56f1882 100644 --- a/Lib/test/test_json/test_speedups.py +++ b/Lib/test/test_json/test_speedups.py @@ -44,3 +44,7 @@ class TestEncode(CTest): self.assertRaises(ZeroDivisionError, test, 'check_circular') self.assertRaises(ZeroDivisionError, test, 'allow_nan') self.assertRaises(ZeroDivisionError, test, 'sort_keys') + + def test_unsortable_keys(self): + with self.assertRaises(TypeError): + self.json.encoder.JSONEncoder(sort_keys=True).encode({'a': 1, 1: 'a'}) |