Skip to content

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

Merged
vstinner merged 1 commit into
python:3.14from
miss-islington:backport-7eada7c-3.14
Sep 30, 2026
Merged

vstinner merged 1 commit into
python:3.14from
miss-islington:backport-7eada7c-3.14

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

Co-authored-by: Victor Stinner <vstinner@python.org>
@vstinner
vstinner enabled auto-merge (squash) September 30, 2026 12:14
@vstinner
vstinner merged commit 13b1a4b into python:3.14 Sep 30, 2026
50 checks passed
@miss-islington
miss-islington deleted the backport-7eada7c-3.14 branch September 30, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants