cpython/Tools/gdb
Miss Islington (bot) bfc3ebe234
[3.15] gh-158451: Fix python-gdb.py for invalid Unicode strings (GH-158475) (#158496)
gh-158451: Fix python-gdb.py for invalid Unicode strings (GH-158475)

python-gdb.py is now able to format an invalid Unicode string:
render invalid characters as "\Uhhhhhhhh" instead of raising an
exception.

The PyUnicodeWriter API fills a UCS-4 buffer with 0xff byte pattern
to detect usage of uninitialized characters. It produces invalid
characters '\Uffffffff'.

PyBytesObjectPtr now iterates on bytes (list of integers), instead of
creating a temporary Unicode string. Add more bytes tests in test_gdb
pretty printer.

Remove the unused 'ch2' variable.
(cherry picked from commit 7eada7c2c6)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-10-09 22:20:05 +02:00
..
libpython.py [3.15] gh-158451: Fix python-gdb.py for invalid Unicode strings (GH-158475) (#158496) 2026-10-09 22:20:05 +02:00