René's URL Explorer Experiment


Title: C API: Detect invalid UCS4 characters in debug mode · Issue #158445 · python/cpython · GitHub

Open Graph Title: C API: Detect invalid UCS4 characters in debug mode · Issue #158445 · python/cpython

X Title: C API: Detect invalid UCS4 characters in debug mode · Issue #158445 · python/cpython

Description: Currently, PyUnicode_FromKindAndData() and PyUnicodeWriter_WriteUCS4() create an invalid string if a character is not in the [U+0000; U+10ffff] range. Instead, I propose to raise an exception in this case. Example creating an invalid str...

Open Graph Description: Currently, PyUnicode_FromKindAndData() and PyUnicodeWriter_WriteUCS4() create an invalid string if a character is not in the [U+0000; U+10ffff] range. Instead, I propose to raise an exception in th...

X Description: Currently, PyUnicode_FromKindAndData() and PyUnicodeWriter_WriteUCS4() create an invalid string if a character is not in the [U+0000; U+10ffff] range. Instead, I propose to raise an exception in th...

Opengraph URL: https://github.com/python/cpython/issues/158445

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"C API: Detect invalid UCS4 characters in debug mode","articleBody":"Currently, PyUnicode_FromKindAndData() and PyUnicodeWriter_WriteUCS4() create an invalid string if a character is not in the [U+0000; U+10ffff] range. Instead, I propose to raise an exception in this case.\n\nExample creating an invalid string:\n\n```\n$ python3.15\n>>> import _testcapi, sys\n>>> invalid_ucs4 = (0x11_0000).to_bytes(4, byteorder=sys.byteorder)\n>>> s = _testcapi.unicode_fromkindanddata(4, invalid_ucs4*5)\n\n>>> list(s)\nSystemError: invalid maximum character passed to PyUnicode_New\n\n>>> s[0]\nSystemError: invalid maximum character passed to PyUnicode_New\n```\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-158447\n* gh-158502\n* gh-158603\n* gh-158604\n* gh-158608\n* gh-159515\n* gh-159519\n* gh-159524\n* gh-159525\n* gh-159540\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2026-09-29T18:10:19Z","url":"https://github.com/python/cpython/issues/158445"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:09c5f053-9809-efc5-cfd4-3ef1277bcb0a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE3E8:34CAB:33BE82C:42322BA:6B01E842
html-safe-nonce4225742458abe43a05ea8ba8c7db981a2fef1f5b0130ea94bf1cd68714181ab2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFM0U4OjM0Q0FCOjMzQkU4MkM6NDIzMjJCQTo2QjAxRTg0MiIsInZpc2l0b3JfaWQiOiIyOTY0NDY1MTUxOTUwMDU1NDkwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmaca6522446357a10404893163365816705fdae3d64c877ae9a4cdb4dbcdab77dbc
hovercard-subject-tagissue:5634929808
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/158445/issue_layout
twitter:imagehttps://opengraph.githubassets.com/44a3b5d0ef96305701a13ea27f975ff6df1ace55a12579685a4d0c89cbe5defa/python/cpython/issues/158445
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/44a3b5d0ef96305701a13ea27f975ff6df1ace55a12579685a4d0c89cbe5defa/python/cpython/issues/158445
og:image:altCurrently, PyUnicode_FromKindAndData() and PyUnicodeWriter_WriteUCS4() create an invalid string if a character is not in the [U+0000; U+10ffff] range. Instead, I propose to raise an exception in th...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamevstinner
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/158445#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F158445
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F158445
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/158445
Reloadhttps://github.com/python/cpython/issues/158445
Reloadhttps://github.com/python/cpython/issues/158445
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/158445
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/158445
C API: Detect invalid UCS4 characters in debug modehttps://github.com/python/cpython/issues/158445#top
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
topic-C-APIhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-C-API%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
on Sep 29, 2026https://github.com/python/cpython/issues/158445#issue-5634929808
gh-158445: Reject invalid UCS4 in PyUnicode_FromKindAndData() #158447https://github.com/python/cpython/pull/158447
gh-158445: Detect invalid UCS4 characters in debug mode #158502https://github.com/python/cpython/pull/158502
gh-158445: Add C API tests on build information functions #158603https://github.com/python/cpython/pull/158603
gh-158445: Skip invalid UCS-4 tests if Python is built with assertions #158604https://github.com/python/cpython/pull/158604
gh-158445: Allocate memory in the heap in Py_GetVersion() #158608https://github.com/python/cpython/pull/158608
[3.15] gh-158445: Add C API tests on build information functions #159515https://github.com/python/cpython/pull/159515
Revert "gh-158445: Allocate memory in the heap in Py_GetVersion() (#158608)" #159519https://github.com/python/cpython/pull/159519
[3.15] gh-158445: Detect invalid UCS4 characters in debug mode (#158502) #159524https://github.com/python/cpython/pull/159524
[3.14] gh-158445: Add C API tests on build information functions (#159515) #159525https://github.com/python/cpython/pull/159525
[3.14] gh-158445: Detect invalid UCS4 characters in debug mode (#158502) (#159524) #159540https://github.com/python/cpython/pull/159540
vstinnerhttps://github.com/vstinner
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
topic-C-APIhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-C-API%22
on Sep 29, 2026https://github.com/python/cpython/issues/158445#event-32103077365
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
on Sep 29, 2026https://github.com/python/cpython/issues/158445#issuecomment-5896145841
vstinnerhttps://github.com/vstinner
on Sep 29, 2026https://github.com/python/cpython/issues/158445#event-32104062176
pythongh-158445: Reject invalid UCS4 in PyUnicode_FromKindAndData()https://github.com/vstinner/cpython/commit/ae17c698930608548cc8c23bbcdd71fe8a7be786
pythongh-158445https://github.com/python/cpython/issues/158445
ae17c69https://github.com/vstinner/cpython/commit/ae17c698930608548cc8c23bbcdd71fe8a7be786
pythongh-158445: Reject invalid UCS4 in PyUnicode_FromKindAndData()https://github.com/vstinner/cpython/commit/da5cb3361114b452488e77ff22db7d7194da5299
pythongh-158445https://github.com/python/cpython/issues/158445
da5cb33https://github.com/vstinner/cpython/commit/da5cb3361114b452488e77ff22db7d7194da5299
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
on Sep 29, 2026https://github.com/python/cpython/issues/158445#issuecomment-5896320000
vstinnerhttps://github.com/vstinner
on Sep 30, 2026https://github.com/python/cpython/issues/158445#event-32170814338
pythongh-158445: Detect invalid UCS4 characters in debug modehttps://github.com/vstinner/cpython/commit/5286181eed042158e3f07f3b8e6ff0127c357f1e
pythongh-158445https://github.com/python/cpython/issues/158445
5286181https://github.com/vstinner/cpython/commit/5286181eed042158e3f07f3b8e6ff0127c357f1e
pythongh-158445: Detect invalid UCS4 characters in debug modehttps://github.com/vstinner/cpython/commit/4a8e7562cfac0a49be748d2715a73e366a20c42d
pythongh-158445https://github.com/python/cpython/issues/158445
4a8e756https://github.com/vstinner/cpython/commit/4a8e7562cfac0a49be748d2715a73e366a20c42d
gh-158445: Detect invalid UCS4 characters in debug mode (#158502)https://github.com/python/cpython/commit/a14a4a6bc9a6e1b930b1a4ba3678cb9ab551c006
gh-158445https://github.com/python/cpython/issues/158445
#158502https://github.com/python/cpython/pull/158502
a14a4a6https://github.com/python/cpython/commit/a14a4a6bc9a6e1b930b1a4ba3678cb9ab551c006
vstinnerhttps://github.com/vstinner
on Sep 30, 2026https://github.com/python/cpython/issues/158445#event-32177808249
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
on Sep 30, 2026https://github.com/python/cpython/issues/158445#issuecomment-5914263503
picnixzhttps://github.com/picnixz
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
on Oct 1, 2026https://github.com/python/cpython/issues/158445#event-32252808761
https://github.com/encukou
encukouhttps://github.com/encukou
on Oct 2, 2026https://github.com/python/cpython/issues/158445#issuecomment-5946948209
vstinnerhttps://github.com/vstinner
on Oct 2, 2026https://github.com/python/cpython/issues/158445#event-32342290089
gh-158445: Add C API tests on build information functions (#158603)https://github.com/python/cpython/commit/a831abba141ceeb0ef8acfada37602aa578cc670
gh-158445https://github.com/python/cpython/issues/158445
#158603https://github.com/python/cpython/pull/158603
a831abbhttps://github.com/python/cpython/commit/a831abba141ceeb0ef8acfada37602aa578cc670
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
on Oct 2, 2026https://github.com/python/cpython/issues/158445#issuecomment-5954952771
https://buildbot.python.org/#/builders/1678/builds/3888https://buildbot.python.org/#/builders/1678/builds/3888
https://buildbot.python.org/#/builders/1245/builds/9676https://buildbot.python.org/#/builders/1245/builds/9676
#158603https://github.com/python/cpython/pull/158603
#158604https://github.com/python/cpython/pull/158604
vstinnerhttps://github.com/vstinner
on Oct 2, 2026https://github.com/python/cpython/issues/158445#event-32344964212
gh-158445: Skip invalid UCS-4 tests if Python is built with assertions (https://github.com/python/cpython/commit/35bdbcad63d629e7e4209117411241d8ac0bd6cf
gh-158445https://github.com/python/cpython/issues/158445
35bdbcahttps://github.com/python/cpython/commit/35bdbcad63d629e7e4209117411241d8ac0bd6cf
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
on Oct 2, 2026https://github.com/python/cpython/issues/158445#issuecomment-5955671568
vstinnerhttps://github.com/vstinner
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 2, 2026https://github.com/python/cpython/issues/158445#event-32345448640
https://github.com/encukou
encukouhttps://github.com/encukou
on Oct 2, 2026https://github.com/python/cpython/issues/158445#issuecomment-5956031766
vstinnerhttps://github.com/vstinner
on Oct 3, 2026https://github.com/python/cpython/issues/158445#event-32398075069
gh-158445: Allocate memory in the heap in Py_GetVersion() (#158608)https://github.com/python/cpython/commit/f5e913c7f710794421e48437f45a65f190830cbf
gh-158445https://github.com/python/cpython/issues/158445
#158608https://github.com/python/cpython/pull/158608
f5e913chttps://github.com/python/cpython/commit/f5e913c7f710794421e48437f45a65f190830cbf
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
on Oct 3, 2026https://github.com/python/cpython/issues/158445#issuecomment-5969553435
https://buildbot.python.org/#/builders/1678/builds/3888https://buildbot.python.org/#/builders/1678/builds/3888
https://buildbot.python.org/#/builders/1245/builds/9676https://buildbot.python.org/#/builders/1245/builds/9676
vstinnerhttps://github.com/vstinner
on Oct 16, 2026https://github.com/python/cpython/issues/158445#event-33437079959
Revert "gh-158445: Allocate memory in the heap in Py_GetVersion() (#1…https://github.com/python/cpython/commit/35a000974a97248ffe4137ac01373f391cfc3728
gh-158445https://github.com/python/cpython/issues/158445
#1…https://github.com/python/cpython/pull/158608
35a0009https://github.com/python/cpython/commit/35a000974a97248ffe4137ac01373f391cfc3728
[3.15] gh-158445: Add C API tests on build information functions (#15…https://github.com/python/cpython/commit/cb7a629f4df7c3ad9535e5ac4ace3769589ec452
gh-158445https://github.com/python/cpython/issues/158445
#15…https://github.com/python/cpython/pull/159515
cb7a629https://github.com/python/cpython/commit/cb7a629f4df7c3ad9535e5ac4ace3769589ec452
[3.14] gh-158445: Add C API tests on build information functions (#15…https://github.com/python/cpython/commit/1de946cf6adcf3f8553b24fbc2c3621b4af26199
gh-158445https://github.com/python/cpython/issues/158445
#15…https://github.com/python/cpython/pull/159515
1de946chttps://github.com/python/cpython/commit/1de946cf6adcf3f8553b24fbc2c3621b4af26199
[3.15] gh-158445: Detect invalid UCS4 characters in debug mode (#158502…https://github.com/python/cpython/commit/2c235059117a9b12d1650876d8413e80a734c31a
gh-158445https://github.com/python/cpython/issues/158445
#158502https://github.com/python/cpython/pull/158502
2c23505https://github.com/python/cpython/commit/2c235059117a9b12d1650876d8413e80a734c31a
[3.14] gh-158445: Detect invalid UCS4 characters in debug mode (#158502…https://github.com/python/cpython/commit/09a7956395e041e6581fed28adf50490d7c2598a
gh-158445https://github.com/python/cpython/issues/158445
#158502https://github.com/python/cpython/pull/158502
09a7956https://github.com/python/cpython/commit/09a7956395e041e6581fed28adf50490d7c2598a
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/158445
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/158445
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
topic-C-APIhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-C-API%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.