Skip to content

[3.15] gh-158451: Fix python-gdb.py for invalid Unicode strings (GH-158475) - #158496

Open
miss-islington wants to merge 1 commit into
python:3.15from
miss-islington:backport-7eada7c-3.15
Open

miss-islington wants to merge 1 commit into
python:3.15from
miss-islington:backport-7eada7c-3.15

Conversation

@miss-islington

@miss-islington miss-islington commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

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 7eada7c)

Co-authored-by: Victor Stinner vstinner@python.org

…nGH-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 7eada7c2c63189fbe753cf5e84b77baf4099a4a1)

Co-authored-by: Victor Stinner <vstinner@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants