mirror of
https://github.com/python/cpython.git
synced 2026-04-20 19:01:14 +00:00
In encoder_encode_key_value(), key is a borrowed reference from
PyDict_Next(). If the default callback mutates or clears the dict,
key becomes a dangling pointer. The error path then calls
_PyErr_FormatNote("%R", key) on freed memory.
Fix by holding strong references to key and value unconditionally
during encoding, not just in the free-threading build.
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
|
||
|---|---|---|
| .. | ||
| __init__.py | ||
| __main__.py | ||
| test_decode.py | ||
| test_default.py | ||
| test_dump.py | ||
| test_encode_basestring_ascii.py | ||
| test_enum.py | ||
| test_fail.py | ||
| test_float.py | ||
| test_indent.py | ||
| test_pass1.py | ||
| test_pass2.py | ||
| test_pass3.py | ||
| test_recursion.py | ||
| test_scanstring.py | ||
| test_separators.py | ||
| test_speedups.py | ||
| test_tool.py | ||
| test_unicode.py | ||