René's URL Explorer Experiment


Title: Possible UB in bytes_characters · Issue #106693 · python/cpython · GitHub

Open Graph Title: Possible UB in bytes_characters · Issue #106693 · python/cpython

X Title: Possible UB in bytes_characters · Issue #106693 · python/cpython

Description: in bytes_characters in https://github.com/python/cpython/blob/main/Include/internal/pycore_runtime_init.h we are doing this: .bytes_characters = _Py_bytes_characters_INIT, \ where #define _Py_bytes_characters_INIT { \ _PyBytes_CHAR_INIT(...

Open Graph Description: in bytes_characters in https://github.com/python/cpython/blob/main/Include/internal/pycore_runtime_init.h we are doing this: .bytes_characters = _Py_bytes_characters_INIT, \ where #define _Py_bytes...

X Description: in bytes_characters in https://github.com/python/cpython/blob/main/Include/internal/pycore_runtime_init.h we are doing this: .bytes_characters = _Py_bytes_characters_INIT, \ where #define _Py_bytes...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Possible UB in bytes_characters","articleBody":"in `bytes_characters` in https://github.com/python/cpython/blob/main/Include/internal/pycore_runtime_init.h we are doing this:\r\n\r\n```\r\n.bytes_characters = _Py_bytes_characters_INIT, \\\r\n```\r\n\r\nwhere\r\n\r\n```\r\n#define _Py_bytes_characters_INIT { \\\r\n    _PyBytes_CHAR_INIT(0), \\\r\n    _PyBytes_CHAR_INIT(1), \\\r\n    _PyBytes_CHAR_INIT(2), \\\r\n    _PyBytes_CHAR_INIT(3), \\\r\n    _PyBytes_CHAR_INIT(4), \\\r\n    _PyBytes_CHAR_INIT(5), \\\r\n    _PyBytes_CHAR_INIT(6), \\\r\n    _PyBytes_CHAR_INIT(7), \\\r\n    _PyBytes_CHAR_INIT(8), \\\r\n    _PyBytes_CHAR_INIT(9), \\\r\n...\r\n    _PyBytes_CHAR_INIT(255), \\\r\n```\r\n\r\nwith\r\n\r\n```\r\n#define _PyBytes_CHAR_INIT(CH) \\\r\n    { \\\r\n        _PyBytes_SIMPLE_INIT((CH), 1) \\\r\n    }\r\n\r\n#define _PyBytes_SIMPLE_INIT(CH, LEN) \\\r\n    { \\\r\n        _PyVarObject_HEAD_INIT(&PyBytes_Type, (LEN)) \\\r\n        .ob_shash = -1, \\\r\n        .ob_sval = { (CH) }, \\\r\n    }\r\n```\r\n\r\nbut\r\n\r\nhttps://github.com/python/cpython/blob/e4b88c1e4ac129b36f99a534387d64f7b8cda8ef/Include/internal/pycore_global_objects.h#L41-L44\r\n\r\nand\r\n\r\nhttps://github.com/python/cpython/blob/e4b88c1e4ac129b36f99a534387d64f7b8cda8ef/Include/cpython/bytesobject.h#L5-L15\r\n\r\nI think this is UB because when we are basically assigning 255 to:\r\n\r\nhttps://github.com/python/cpython/blob/e4b88c1e4ac129b36f99a534387d64f7b8cda8ef/Include/cpython/bytesobject.h#L8C10-L8C17\r\n\r\nand that should be a `unsigned char` because the range of `char` can be 0 to 255 or -128 to 127 depending on the platform.\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-106826\n* gh-149510\n* gh-149511\n* gh-149514\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/pablogsal","@type":"Person","name":"pablogsal"},"datePublished":"2023-07-12T20:36:07Z","url":"https://github.com/python/cpython/issues/106693"}

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:99fd2700-aeb9-fb72-7a19-afb17ba49e7c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8B2C:19AA62:3AF61AA:4AD292D:6B01FE7C
html-safe-nonce0c6e36fb2915b0093abe0f8b3821ae990d89ae325cb5103d17e919bb92b9c44c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjJDOjE5QUE2MjozQUY2MUFBOjRBRDI5MkQ6NkIwMUZFN0MiLCJ2aXNpdG9yX2lkIjoiODczOTE3MzY0MjQ3MzMwNDI4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacd340cfb24c9bcd82e85bfba351fcddc7f9b8cdfd0cf93b2626c619a514e0baed
hovercard-subject-tagissue:1801717214
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/106693/issue_layout
twitter:imagehttps://opengraph.githubassets.com/62930cac339a533b1e29736f44980e547bf576a8a675fdd4635fe5c3eccb4cce/python/cpython/issues/106693
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/62930cac339a533b1e29736f44980e547bf576a8a675fdd4635fe5c3eccb4cce/python/cpython/issues/106693
og:image:altin bytes_characters in https://github.com/python/cpython/blob/main/Include/internal/pycore_runtime_init.h we are doing this: .bytes_characters = _Py_bytes_characters_INIT, \ where #define _Py_bytes...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepablogsal
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
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
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/106693#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F106693
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%2F106693
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/106693
Reloadhttps://github.com/python/cpython/issues/106693
Reloadhttps://github.com/python/cpython/issues/106693
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/106693
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/106693
Possible UB in bytes_charactershttps://github.com/python/cpython/issues/106693#top
https://github.com/ericsnowcurrently
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
topic-subinterpretershttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-subinterpreters%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/pablogsal
pablogsalhttps://github.com/pablogsal
on Jul 12, 2023https://github.com/python/cpython/issues/106693#issue-1801717214
https://github.com/python/cpython/blob/main/Include/internal/pycore_runtime_init.hhttps://github.com/python/cpython/blob/main/Include/internal/pycore_runtime_init.h
cpython/Include/internal/pycore_global_objects.hhttps://github.com/python/cpython/blob/e4b88c1e4ac129b36f99a534387d64f7b8cda8ef/Include/internal/pycore_global_objects.h#L41-L44
e4b88c1https://github.com/python/cpython/commit/e4b88c1e4ac129b36f99a534387d64f7b8cda8ef
cpython/Include/cpython/bytesobject.hhttps://github.com/python/cpython/blob/e4b88c1e4ac129b36f99a534387d64f7b8cda8ef/Include/cpython/bytesobject.h#L5-L15
e4b88c1https://github.com/python/cpython/commit/e4b88c1e4ac129b36f99a534387d64f7b8cda8ef
https://github.com/python/cpython/blob/e4b88c1e4ac129b36f99a534387d64f7b8cda8ef/Include/cpython/bytesobject.h#L8C10-L8C17https://github.com/python/cpython/blob/e4b88c1e4ac129b36f99a534387d64f7b8cda8ef/Include/cpython/bytesobject.h#L8C10-L8C17
gh-106693: Explicitly mark ob_sval as unsigned char to avoid UB #106826https://github.com/python/cpython/pull/106826
[3.14] gh-106693: Explicitly mark ob_sval as unsigned char to avoid UB (GH-106826) #149510https://github.com/python/cpython/pull/149510
[3.13] gh-106693: Explicitly mark ob_sval as unsigned char to avoid UB (GH-106826) #149511https://github.com/python/cpython/pull/149511
gh-106693: Revert "Explicitly mark ob_sval as unsigned char to avoid UB (#106826)" #149514https://github.com/python/cpython/pull/149514
pablogsalhttps://github.com/pablogsal
markshannonhttps://github.com/markshannon
brandtbucherhttps://github.com/brandtbucher
ericsnowcurrentlyhttps://github.com/ericsnowcurrently
on Jul 12, 2023https://github.com/python/cpython/issues/106693#event-9803786204
https://github.com/godlygeek
godlygeekhttps://github.com/godlygeek
on Jul 12, 2023https://github.com/python/cpython/issues/106693#issuecomment-1633204871
pablogsalhttps://github.com/pablogsal
on Jul 17, 2023https://github.com/python/cpython/issues/106693#event-9839483078
pythongh-106693: Explicitly mark ob_sval as unsigned char to avoid UBhttps://github.com/pablogsal/cpython/commit/16961d0855c340ec57bfb7eb65a06c4ff4ce5a48
pythongh-106693https://github.com/python/cpython/issues/106693
16961d0https://github.com/pablogsal/cpython/commit/16961d0855c340ec57bfb7eb65a06c4ff4ce5a48
pythongh-106693: Explicitly mark ob_sval as unsigned char to avoid UBhttps://github.com/pablogsal/cpython/commit/89c88a25963f8e6fec54512ef5239a33d8450207
pythongh-106693https://github.com/python/cpython/issues/106693
89c88a2https://github.com/pablogsal/cpython/commit/89c88a25963f8e6fec54512ef5239a33d8450207
https://github.com/ericsnowcurrently
ericsnowcurrentlyhttps://github.com/ericsnowcurrently
on Jul 17, 2023https://github.com/python/cpython/issues/106693#issuecomment-1638664616
https://github.com/pablogsal
pablogsalhttps://github.com/pablogsal
on Jul 17, 2023https://github.com/python/cpython/issues/106693#issuecomment-1638774388
https://github.com/markshannon
markshannonhttps://github.com/markshannon
on Aug 1, 2023https://github.com/python/cpython/issues/106693#issuecomment-1660472302
https://github.com/markshannon
markshannonhttps://github.com/markshannon
on Aug 1, 2023https://github.com/python/cpython/issues/106693#issuecomment-1660483682
ericsnowcurrentlyhttps://github.com/ericsnowcurrently
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
topic-subinterpretershttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-subinterpreters%22
on Feb 27, 2024https://github.com/python/cpython/issues/106693#event-11940373093
github-project-automationhttps://github.com/apps/github-project-automation
Subinterpretershttps://github.com/orgs/python/projects/3
on Feb 27, 2024https://github.com/python/cpython/issues/106693#event-14874031918
github-project-automationhttps://github.com/apps/github-project-automation
Subinterpretershttps://github.com/orgs/python/projects/3
on Feb 27, 2024https://github.com/python/cpython/issues/106693
pablogsalhttps://github.com/pablogsal
on May 1, 2024https://github.com/python/cpython/issues/106693#event-12670579467
pythongh-106693: Explicitly mark ob_sval as unsigned char to avoid UBhttps://github.com/pablogsal/cpython/commit/eecd6a8cd494d650d7fe2407f7d1e6fee4b28f19
pythongh-106693https://github.com/python/cpython/issues/106693
eecd6a8https://github.com/pablogsal/cpython/commit/eecd6a8cd494d650d7fe2407f7d1e6fee4b28f19
markshannonhttps://github.com/markshannon
markshannonhttps://github.com/markshannon
brandtbucherhttps://github.com/brandtbucher
on Aug 23, 2024https://github.com/python/cpython/issues/106693#event-13990774335
pablogsalhttps://github.com/pablogsal
on Sep 19, 2025https://github.com/python/cpython/issues/106693#event-19796171458
Merge branch 'main' into pythongh-106693https://github.com/pablogsal/cpython/commit/a97c0837d01c5b6c9dbb226805584cb1baa6eb17
pythongh-106693https://github.com/python/cpython/issues/106693
a97c083https://github.com/pablogsal/cpython/commit/a97c0837d01c5b6c9dbb226805584cb1baa6eb17
pablogsalhttps://github.com/pablogsal
on May 7, 2026https://github.com/python/cpython/issues/106693#event-25276031056
gh-106693: Explicitly mark ob_sval as unsigned char to avoid UB (#106826https://github.com/python/cpython/commit/fbba343622c9e4a38c8ef0f0b0e311164394d76a
gh-106693https://github.com/python/cpython/issues/106693
#106826https://github.com/python/cpython/pull/106826
fbba343https://github.com/python/cpython/commit/fbba343622c9e4a38c8ef0f0b0e311164394d76a
hugovkhttps://github.com/hugovk
on May 7, 2026https://github.com/python/cpython/issues/106693#event-25279181237
gh-106693: Revert "Explicitly mark ob_sval as unsigned char to avoid …https://github.com/python/cpython/commit/f0daba1652cbf2eb04feaf21f9c913023f286e7e
gh-106693https://github.com/python/cpython/issues/106693
f0daba1https://github.com/python/cpython/commit/f0daba1652cbf2eb04feaf21f9c913023f286e7e
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on Jun 28, 2026https://github.com/python/cpython/issues/106693#issuecomment-4827140807
#149514https://github.com/python/cpython/pull/149514
f0daba1https://github.com/python/cpython/commit/f0daba1652cbf2eb04feaf21f9c913023f286e7e
gh-79638https://github.com/python/cpython/issues/79638
gh-79638https://github.com/python/cpython/issues/79638
310fe88https://github.com/python/cpython/commit/310fe88994249a5a02e20d1211b8fc067e34aa78
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 Jun 28, 2026https://github.com/python/cpython/issues/106693#event-27303950890
serhiy-storchakahttps://github.com/serhiy-storchaka
on Jul 5, 2026https://github.com/python/cpython/issues/106693#event-27572337094
gh-79638: Restore "Treat an unreachable robots.txt as disallow all" (G…https://github.com/python/cpython/commit/70100b9ea0b43a95226eee45652a5735bb91e9c7
gh-79638https://github.com/python/cpython/issues/79638
G…https://github.com/python/cpython/pull/152525
70100b9https://github.com/python/cpython/commit/70100b9ea0b43a95226eee45652a5735bb91e9c7
[3.13] gh-79638: Restore "Treat an unreachable robots.txt as disallow…https://github.com/python/cpython/commit/d35cfee409db4eceeaa389c206e4a18eeb6eaf9d
gh-79638https://github.com/python/cpython/issues/79638
d35cfeehttps://github.com/python/cpython/commit/d35cfee409db4eceeaa389c206e4a18eeb6eaf9d
[3.14] gh-79638: Restore "Treat an unreachable robots.txt as disallow…https://github.com/python/cpython/commit/a624878b25582ed018ae0ea347bb672f5704e1a1
gh-79638https://github.com/python/cpython/issues/79638
a624878https://github.com/python/cpython/commit/a624878b25582ed018ae0ea347bb672f5704e1a1
[3.15] gh-79638: Restore "Treat an unreachable robots.txt as disallow…https://github.com/python/cpython/commit/2a5f9e0e24f270c77d0eb11b69fe99e6c8aecd8f
gh-79638https://github.com/python/cpython/issues/79638
2a5f9e0https://github.com/python/cpython/commit/2a5f9e0e24f270c77d0eb11b69fe99e6c8aecd8f
serhiy-storchakahttps://github.com/serhiy-storchaka
on Aug 8, 2026https://github.com/python/cpython/issues/106693#event-29166293974
pythongh-79638: Restore "Treat an unreachable robots.txt as disallow …https://github.com/serhiy-storchaka/cpython/commit/b9466ebcb967d0192fb1ae059381e9f0f784a1ed
pythongh-79638https://github.com/python/cpython/issues/79638
b9466ebhttps://github.com/serhiy-storchaka/cpython/commit/b9466ebcb967d0192fb1ae059381e9f0f784a1ed
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/106693
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/106693
ericsnowcurrentlyhttps://github.com/ericsnowcurrently
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
topic-subinterpretershttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-subinterpreters%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
Subinterpretershttps://github.com/orgs/python/projects/3
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.