cpython/Lib/test/test_json
Shamil e87baa8d24
[3.13] gh-142831: Fix use-after-free in json encoder during re-entrant mutation (gh-142851) (#150079)
gh-142831: Fix use-after-free in json encoder during re-entrant mutation (gh-142851)

User callbacks invoked during JSON encoding (e.g. the `default` callback or
a custom string encoder) can mutate or clear the dict or sequence being
encoded, invalidating borrowed references to items, keys, and values. Hold
strong references unconditionally while iterating.



(cherry picked from commit 235fa7244a)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-05-19 20:33:22 -07:00
..
__init__.py Revert "GH-96145: Add AttrDict to JSON module for use with object_hook (#96146)" (#105948) 2023-06-26 20:35:53 +02:00
__main__.py
json_lines.jsonl [3.13] gh-132631: Fix "I/O operation on closed file" when parsing JSON Lines file (GH-132632) (#148922) 2026-04-23 19:30:13 +00:00
test_decode.py [3.13] gh-125682: Reject non-ASCII digits in the Python implementation of JSON decoder (GH-125687) (GH-125692) 2024-10-21 16:06:31 +03:00
test_default.py gh-100272: Fix JSON serialization of OrderedDict (GH-100273) 2022-12-17 14:32:48 +02:00
test_dump.py [3.13] gh-131884: Fix incorrect formatting in json.dumps() when using indent and skipkeys=True (GH-132200) (GH-135061) 2025-06-05 14:38:11 +00:00
test_encode_basestring_ascii.py [3.13] gh-140793: Improve documentatation and tests for the ensure_ascii option in the json module (GH-140906) (GH-141228) 2025-11-08 10:30:15 +00:00
test_enum.py
test_fail.py gh-115692: Add tests to increase json coverage (#115693) 2024-04-14 06:11:06 -06:00
test_float.py gh-99925: Fix inconsistency in json.dumps() error messages (GH-99926) 2022-12-20 12:54:56 +02:00
test_indent.py
test_pass1.py gh-96959: Update HTTP links which are redirected to HTTPS (GH-96961) 2022-09-24 14:38:53 +03:00
test_pass2.py gh-96959: Update HTTP links which are redirected to HTTPS (GH-96961) 2022-09-24 14:38:53 +03:00
test_pass3.py gh-96959: Update HTTP links which are redirected to HTTPS (GH-96961) 2022-09-24 14:38:53 +03:00
test_recursion.py [3.13] gh-134578: Mark more slow tests (GH-134579) (GH-134592) 2025-05-23 17:31:05 +00:00
test_scanstring.py [3.13] gh-137821: Fix wrongly tested json.decoder.scanstring (gh-140781) 2025-10-30 22:51:10 +09:00
test_separators.py
test_speedups.py [3.13] gh-142831: Fix use-after-free in json encoder during re-entrant mutation (gh-142851) (#150079) 2026-05-19 20:33:22 -07:00
test_tool.py [3.13] gh-132631: Fix "I/O operation on closed file" when parsing JSON Lines file (GH-132632) (#148922) 2026-04-23 19:30:13 +00:00
test_unicode.py [3.13] gh-140793: Improve documentatation and tests for the ensure_ascii option in the json module (GH-140906) (GH-141228) 2025-11-08 10:30:15 +00:00