summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_json/test_speedups.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-07-16 04:29:16 (GMT)
committerGitHub <noreply@github.com>2017-07-16 04:29:16 (GMT)
commit49f6449ef4b81537c19b82329caaf60596c516c2 (patch)
tree416e402ff426c12cca2324506363d4be167adf95 /Lib/test/test_json/test_speedups.py
parent95bebb7264afad88f31f7cdc3b28bacde7c46f93 (diff)
downloadcpython-49f6449ef4b81537c19b82329caaf60596c516c2.zip
cpython-49f6449ef4b81537c19b82329caaf60596c516c2.tar.gz
cpython-49f6449ef4b81537c19b82329caaf60596c516c2.tar.bz2
bpo-30936: Fix a reference leak in json when fail to sort keys. (#2712)
Diffstat (limited to 'Lib/test/test_json/test_speedups.py')
-rw-r--r--Lib/test/test_json/test_speedups.py4
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'})