cpython/Lib/test/test_json
Shamil bba6c1d9d5
[3.14] gh-142831: Fix use-after-free in json encoder during re-entrant mutation (gh-142851) (#150078)
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:31:43 -07:00
..
__init__.py
__main__.py
json_lines.jsonl [3.14] gh-132631: Fix "I/O operation on closed file" when parsing JSON Lines file (GH-132632) (#148921) 2026-04-23 19:32:29 +03:00
test_decode.py gh-125682: Reject non-ASCII digits in the Python implementation of JSON decoder (GH-125687) 2024-10-18 15:26:29 +03:00
test_default.py
test_dump.py [3.14] gh-131884: Fix incorrect formatting in json.dumps() when using indent and skipkeys=True (GH-132200) (GH-135060) 2025-06-05 14:38:09 +00:00
test_encode_basestring_ascii.py [3.14] gh-140793: Improve documentatation and tests for the ensure_ascii option in the json module (GH-140906) (GH-141227) 2025-11-08 10:32:44 +00:00
test_enum.py
test_fail.py [3.14] gh-71339: Use new assertion methods in tests (GH-129046) (GH-134498) 2025-05-22 10:42:50 +00:00
test_float.py
test_indent.py
test_pass1.py
test_pass2.py
test_pass3.py
test_recursion.py [3.14] gh-143460: Skip infinite recusion tests for infinite stack size (GH-143606) (#143619) 2026-01-09 16:54:49 +00:00
test_scanstring.py [3.14] gh-137821: Fix wrongly tested json.decoder.scanstring (gh-140782) 2025-10-30 22:51:25 +09:00
test_separators.py
test_speedups.py [3.14] gh-142831: Fix use-after-free in json encoder during re-entrant mutation (gh-142851) (#150078) 2026-05-19 20:31:43 -07:00
test_tool.py [3.14] gh-132631: Fix "I/O operation on closed file" when parsing JSON Lines file (GH-132632) (#148921) 2026-04-23 19:32:29 +03:00
test_unicode.py [3.14] gh-140793: Improve documentatation and tests for the ensure_ascii option in the json module (GH-140906) (GH-141227) 2025-11-08 10:32:44 +00:00