Skip to content

gh-156939: Document that PyASCIIObject ends with null byte - #157708

Merged
vstinner merged 2 commits into
python:mainfrom
vstinner:unicode_capi
Sep 19, 2026
Merged

vstinner merged 2 commits into
python:mainfrom
vstinner:unicode_capi

Conversation

@vstinner

@vstinner vstinner commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Document also that PyUnicode_READ_CHAR() supports reading the trailing null byte.

Add tests on PyUnicode_READ_CHAR().

@vstinner

Copy link
Copy Markdown
Member Author

This PR is similar to #157236 which documents PyBytesObject trailing null byte.

@read-the-docs-community

read-the-docs-community Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34650751 | 📁 Comparing eef4c0c against main (5539c2a)

  🔍 Preview build  

6 files changed · ± 6 modified

± Modified

Document also that PyUnicode_READ_CHAR() supports reading the
trailing null byte.
@vstinner
vstinner enabled auto-merge (squash) September 19, 2026 13:49
@vstinner
vstinner merged commit 4d3b405 into python:main Sep 19, 2026
31 checks passed
@vstinner
vstinner deleted the unicode_capi branch September 19, 2026 13:56
@vstinner vstinner added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Oct 16, 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 Oct 16, 2026

Copy link
Copy Markdown

GH-159530 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 Oct 16, 2026
@bedevere-app

bedevere-app Bot commented Oct 16, 2026

Copy link
Copy Markdown

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Oct 16, 2026
vstinner added a commit that referenced this pull request Oct 16, 2026
…ter (GH-157708) (#159530)

gh-156939: Document that PyUnicodeObject ends with null character (GH-157708)

Document also that PyUnicode_READ() and PyUnicode_READ_CHAR()
accept reading the trailing null character, and that PyUnicode_GetLength()
doesn't count the trailing null character.
(cherry picked from commit 4d3b405)

Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner added a commit that referenced this pull request Oct 16, 2026
…ter (GH-157708) (#159531)

gh-156939: Document that PyUnicodeObject ends with null character (GH-157708)

Document also that PyUnicode_READ() and PyUnicode_READ_CHAR()
accept reading the trailing null character, and that PyUnicode_GetLength()
doesn't count the trailing null character.
(cherry picked from commit 4d3b405)

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

1 participant