Skip to content

gh-158451: Fix python-gdb.py for invalid Unicode strings - #158475

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:gdb_unicode
Sep 30, 2026
Merged

vstinner merged 1 commit into
python:mainfrom
vstinner:gdb_unicode

Conversation

@vstinner

@vstinner vstinner commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

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.

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.
@vstinner

Copy link
Copy Markdown
Member Author

!buildbot AMD64 Ubuntu

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @vstinner for commit 1fada1c 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F158475%2Fmerge

The command will test the builders whose names match following regular expression: AMD64 Ubuntu

The builders matched are:

  • AMD64 Ubuntu PR
  • AMD64 Ubuntu Shared PR

@vstinner

Copy link
Copy Markdown
Member Author

!buildbot AMD64 Fedora Stable PR

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @vstinner for commit 1fada1c 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F158475%2Fmerge

The command will test the builders whose names match following regular expression: AMD64 Fedora Stable PR

The builders matched are:

  • AMD64 Fedora Stable PR

@vstinner
vstinner merged commit 7eada7c into python:main Sep 30, 2026
56 checks passed
@vstinner
vstinner deleted the gdb_unicode branch September 30, 2026 12:13
@vstinner vstinner added needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Sep 30, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Sep 30, 2026

Copy link
Copy Markdown

GH-158495 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Sep 30, 2026
@bedevere-app

bedevere-app Bot commented Sep 30, 2026

Copy link
Copy Markdown

GH-158496 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Sep 30, 2026
vstinner added a commit that referenced this pull request Sep 30, 2026
…58475) (#158495)

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants