Unverified Kaydet (Commit) ae00fb1d authored tarafından Serhiy Storchaka's avatar Serhiy Storchaka Kaydeden (comit) GitHub

bpo-30877: Fix clearing a cache in the the JSON decoder. (GH-7048)

üst 55bfe690
......@@ -68,6 +68,6 @@ def py_make_scanner(context):
finally:
memo.clear()
return _scan_once
return scan_once
make_scanner = c_make_scanner or py_make_scanner
......@@ -58,7 +58,9 @@ class TestDecode:
def test_keys_reuse(self):
s = '[{"a_key": 1, "b_\xe9": 2}, {"a_key": 3, "b_\xe9": 4}]'
self.check_keys_reuse(s, self.loads)
self.check_keys_reuse(s, self.json.decoder.JSONDecoder().decode)
decoder = self.json.decoder.JSONDecoder()
self.check_keys_reuse(s, decoder.decode)
self.assertFalse(decoder.memo)
def test_extra_data(self):
s = '[1, 2, 3]5'
......
Fixed a bug in the Python implementation of the JSON decoder that prevented
the cache of parsed strings from clearing after finishing the decoding.
Based on patch by c-fos.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment