René's URL Explorer Experiment


Title: gh-71810: Fix _PyLong_AsByteArray() undefined behavior by vstinner · Pull Request #138873 · python/cpython · GitHub

Open Graph Title: gh-71810: Fix _PyLong_AsByteArray() undefined behavior by vstinner · Pull Request #138873 · python/cpython

X Title: gh-71810: Fix _PyLong_AsByteArray() undefined behavior by vstinner · Pull Request #138873 · python/cpython

Description: The Python programming language. Contribute to python/cpython development by creating an account on GitHub.

Open Graph Description: Don't read p[-1] when p is an empty string: when n==0. Issue: int.to_bytes() and int.from_bytes(): raise ValueError when bytes count is zero #71810

X Description: Don't read p[-1] when p is an empty string: when n==0. Issue: int.to_bytes() and int.from_bytes(): raise ValueError when bytes count is zero #71810

Opengraph URL: https://github.com/python/cpython/pull/138873

X: @github

direct link

Domain: github.com

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/voltron/pull_requests/show/:user_id/:repository/:id/pull_request_layout(.:format)
route-controllervoltron_pull_requests_fragments
route-actionpull_request_layout
fetch-noncev2:4f66dd19-cdd1-1a59-7631-b02bf97cc779
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDE7A:187C1E:138D593:19DB7EE:6B01F0BF
html-safe-nonce8efb2f3051df6f7e6cd1f8ce25465356ae5b500b27fcf9012b8d8cd1e494f36e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERTdBOjE4N0MxRToxMzhENTkzOjE5REI3RUU6NkIwMUYwQkYiLCJ2aXNpdG9yX2lkIjoiMzY4NDg0NjAwNjMyNDgxODExMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacad580fc7c8f51b21bf0606ff1e79c61400313f2e93b15ffd3cf7f11d70c7ea53
hovercard-subject-tagpull_request:2825712200
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/pull_requests_fragments/pull_request_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/voltron/pull_requests/show/python/cpython/138873/pull_request_layout
twitter:imagehttps://opengraph.githubassets.com/6d9a1a84561606f9825274954936819f4f7093cc99b0b5d2f447e3aaa0a4eb5f/python/cpython/pull/138873
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/6d9a1a84561606f9825274954936819f4f7093cc99b0b5d2f447e3aaa0a4eb5f/python/cpython/pull/138873
og:image:altDon't read p[-1] when p is an empty string: when n==0. Issue: int.to_bytes() and int.from_bytes(): raise ValueError when bytes count is zero #71810
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamevstinner
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-cache
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-targetfull
theme-color#1e2327
color-schemelight dark
react-app-namepull-requests

Links:

Skip to contenthttps://github.com/python/cpython/pull/138873#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F138873
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%2Fpull%2F138873
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%2Fpull_requests_fragments%2Fpull_request_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/138873
Reloadhttps://github.com/python/cpython/pull/138873
Reloadhttps://github.com/python/cpython/pull/138873
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
vstinnerhttps://github.com/vstinner
python:mainhttps://github.com/python/cpython/tree/main
vstinner:int_to_bytes_undefhttps://github.com/vstinner/cpython/tree/int_to_bytes_undef
Conversationhttps://github.com/python/cpython/pull/138873
Commits2 (2)https://github.com/python/cpython/pull/138873/commits
Checkshttps://github.com/python/cpython/pull/138873/checks
Files changedhttps://github.com/python/cpython/pull/138873/files
gh-71810: Fix _PyLong_AsByteArray() undefined behaviorhttps://github.com/python/cpython/pull/138873#top
vstinnerhttps://github.com/vstinner
python:mainhttps://github.com/python/cpython/tree/main
vstinner:int_to_bytes_undefhttps://github.com/vstinner/cpython/tree/int_to_bytes_undef
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
Sep 13, 2025https://github.com/python/cpython/pull/138873#issue-3413886064
Please reload this pagehttps://github.com/python/cpython/pull/138873
int.to_bytes() and int.from_bytes(): raise ValueError when bytes count is zero #71810https://github.com/python/cpython/issues/71810
Please reload this pagehttps://github.com/python/cpython/pull/138873
https://github.com/vstinner
pythongh-71810https://github.com/python/cpython/issues/71810
: Fix _PyLong_AsByteArray() undefined behaviorhttps://github.com/python/cpython/pull/138873/commits/39067659f5fe147aff23cb1f2b8158ae1353b321
3906765https://github.com/python/cpython/pull/138873/commits/39067659f5fe147aff23cb1f2b8158ae1353b321
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
skip news https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22skip%20news%22
Sep 13, 2025https://github.com/python/cpython/pull/138873#event-19679689300
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
awaiting core review https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22awaiting%20core%20review%22
Sep 13, 2025https://github.com/python/cpython/pull/138873#event-19679689478
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
Sep 13, 2025 https://github.com/python/cpython/pull/138873#ref-issue-1198956046
int.to_bytes() and int.from_bytes(): raise ValueError when bytes count is zero #71810 https://github.com/python/cpython/issues/71810
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
Sep 13, 2025 https://github.com/python/cpython/pull/138873#ref-pullrequest-3401976366
gh-71810: fix corner case (length==0) for int.to_bytes() #138739 https://github.com/python/cpython/pull/138739
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
Sep 13, 2025https://github.com/python/cpython/pull/138873#issuecomment-3288673903
@skirpichevhttps://github.com/skirpichev
@serhiy-storchakahttps://github.com/serhiy-storchaka
Please reload this pagehttps://github.com/python/cpython/pull/138873
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
Sep 13, 2025 https://github.com/python/cpython/pull/138873#ref-pullrequest-3410574042
gh-129813, PEP 782: Use PyBytesWriter in _PyBytes_FormatEx() #138839 https://github.com/python/cpython/pull/138839
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
Sep 13, 2025 https://github.com/python/cpython/pull/138873#pullrequestreview-3221268711
View reviewed changes https://github.com/python/cpython/pull/138873/files/4b89325a60dbe9a0f2d807c04c13d9df1a8986d1
serhiy-storchakahttps://github.com/serhiy-storchaka
https://github.com/python/cpython/pull/138873#pullrequestreview-3221268711
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/138873
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
awaiting merge https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22awaiting%20merge%22
awaiting core review https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22awaiting%20core%20review%22
Sep 13, 2025https://github.com/python/cpython/pull/138873#event-19680379085
https://github.com/skirpichev
Merge branch 'main' into int_to_bytes_undefhttps://github.com/python/cpython/pull/138873/commits/4b89325a60dbe9a0f2d807c04c13d9df1a8986d1
4b89325https://github.com/python/cpython/pull/138873/commits/4b89325a60dbe9a0f2d807c04c13d9df1a8986d1
https://github.com/skirpichev
skirpichevhttps://github.com/skirpichev
needs backport to 3.13 https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22needs%20backport%20to%203.13%22
needs backport to 3.14 https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22needs%20backport%20to%203.14%22
Sep 14, 2025https://github.com/python/cpython/pull/138873#event-19682963050
https://github.com/skirpichev
skirpichevhttps://github.com/skirpichev
Sep 14, 2025 https://github.com/python/cpython/pull/138873#pullrequestreview-3221719408
View reviewed changes https://github.com/python/cpython/pull/138873/files/4b89325a60dbe9a0f2d807c04c13d9df1a8986d1
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
8b5ce31https://github.com/python/cpython/commit/8b5ce31c2b44d9bf82e6119e90a52dd530bfd1db
Sep 14, 2025https://github.com/python/cpython/pull/138873#event-19684294601
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
September 14, 2025 09:25https://github.com/python/cpython/pull/138873#event-19684294698
https://github.com/apps/miss-islington-app
miss-islington-apphttps://github.com/apps/miss-islington-app
Sep 14, 2025https://github.com/python/cpython/pull/138873#issuecomment-3289386734
@vstinnerhttps://github.com/vstinner
Please reload this pagehttps://github.com/python/cpython/pull/138873
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
awaiting merge https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22awaiting%20merge%22
Sep 14, 2025https://github.com/python/cpython/pull/138873#event-19684294910
miss-islingtonhttps://github.com/miss-islington
Sep 14, 2025 https://github.com/python/cpython/pull/138873#ref-commit-e234ea6
https://github.com/vstinner
https://github.com/miss-islington
pythongh-71810https://github.com/python/cpython/issues/71810
: Fix _PyLong_AsByteArray() undefined behavior (https://github.com/miss-islington/cpython/commit/e234ea612c8510a40087aa871012843a5083fc0c
pythonG…https://github.com/python/cpython/pull/138873
e234ea6https://github.com/miss-islington/cpython/commit/e234ea612c8510a40087aa871012843a5083fc0c
…H-138873https://github.com/python/cpython/pull/138873
8b5ce31https://github.com/miss-islington/cpython/commit/8b5ce31c2b44d9bf82e6119e90a52dd530bfd1db
miss-islingtonhttps://github.com/miss-islington
Sep 14, 2025 https://github.com/python/cpython/pull/138873#ref-commit-fd1444e
https://github.com/vstinner
https://github.com/miss-islington
pythongh-71810https://github.com/python/cpython/issues/71810
: Fix _PyLong_AsByteArray() undefined behavior (https://github.com/miss-islington/cpython/commit/fd1444e0b093ef3b871c189fe7b8668f5c354529
pythonG…https://github.com/python/cpython/pull/138873
fd1444ehttps://github.com/miss-islington/cpython/commit/fd1444e0b093ef3b871c189fe7b8668f5c354529
…H-138873https://github.com/python/cpython/pull/138873
8b5ce31https://github.com/miss-islington/cpython/commit/8b5ce31c2b44d9bf82e6119e90a52dd530bfd1db
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
Sep 14, 2025https://github.com/python/cpython/pull/138873#issuecomment-3289386968
GH-138883https://github.com/python/cpython/pull/138883
3.14 branchhttps://github.com/python/cpython/tree/3.14
Please reload this pagehttps://github.com/python/cpython/pull/138873
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
needs backport to 3.14 https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22needs%20backport%20to%203.14%22
Sep 14, 2025https://github.com/python/cpython/pull/138873#event-19684296828
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
Sep 14, 2025https://github.com/python/cpython/pull/138873#issuecomment-3289387016
GH-138884https://github.com/python/cpython/pull/138884
3.13 branchhttps://github.com/python/cpython/tree/3.13
Please reload this pagehttps://github.com/python/cpython/pull/138873
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
needs backport to 3.13 https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22needs%20backport%20to%203.13%22
Sep 14, 2025https://github.com/python/cpython/pull/138873#event-19684297105
vstinnerhttps://github.com/vstinner
Sep 14, 2025 https://github.com/python/cpython/pull/138873#ref-commit-a902058
https://github.com/miss-islington
https://github.com/vstinner
[3.13]https://github.com/python/cpython/commit/a9020589de6321310720ca550f48793ab5b42d93
gh-71810https://github.com/python/cpython/issues/71810
: Fix _PyLong_AsByteArray() undefined behavior (https://github.com/python/cpython/commit/a9020589de6321310720ca550f48793ab5b42d93
GH-138873https://github.com/python/cpython/pull/138873
a902058https://github.com/python/cpython/commit/a9020589de6321310720ca550f48793ab5b42d93
https://github.com/python/cpython/pull/138873
#138884https://github.com/python/cpython/pull/138884
gh-71810https://github.com/python/cpython/issues/71810
GH-138873https://github.com/python/cpython/pull/138873
8b5ce31https://github.com/python/cpython/commit/8b5ce31c2b44d9bf82e6119e90a52dd530bfd1db
https://github.com/bedevere-bot
bedevere-bothttps://github.com/bedevere-bot
Sep 14, 2025https://github.com/python/cpython/pull/138873#issuecomment-3289472051
a902058https://github.com/python/cpython/commit/a9020589de6321310720ca550f48793ab5b42d93
the buildbot page in the devguidehttps://devguide.python.org/buildbots/
https://buildbot.python.org/#/builders/1396/builds/1590https://buildbot.python.org/#/builders/1396/builds/1590
a902058https://github.com/python/cpython/commit/a9020589de6321310720ca550f48793ab5b42d93
https://buildbot.python.org/#/builders/1396/builds/1590https://buildbot.python.org/#/builders/1396/builds/1590
Please reload this pagehttps://github.com/python/cpython/pull/138873
vstinnerhttps://github.com/vstinner
Oct 7, 2025 https://github.com/python/cpython/pull/138873#ref-commit-b343009
https://github.com/miss-islington
https://github.com/vstinner
[3.14]https://github.com/python/cpython/commit/b343009377b632cd07863475e33238b592d984f5
gh-71810https://github.com/python/cpython/issues/71810
: Fix _PyLong_AsByteArray() undefined behavior (https://github.com/python/cpython/commit/b343009377b632cd07863475e33238b592d984f5
GH-138873https://github.com/python/cpython/pull/138873
b343009https://github.com/python/cpython/commit/b343009377b632cd07863475e33238b592d984f5
https://github.com/python/cpython/pull/138873
#138883https://github.com/python/cpython/pull/138883
gh-71810https://github.com/python/cpython/issues/71810
GH-138873https://github.com/python/cpython/pull/138873
8b5ce31https://github.com/python/cpython/commit/8b5ce31c2b44d9bf82e6119e90a52dd530bfd1db
https://github.co/hiddenchars
https://github.com/python/cpython/pull/{{ revealButtonHref }}
Sign up for freehttps://github.com/join?source=comment-repo
Sign in to commenthttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F138873
https://github.com/skirpichev
skirpichev https://github.com/skirpichev
https://github.com/python/cpython/pull/138873/files/4b89325a60dbe9a0f2d807c04c13d9df1a8986d1
https://github.com/serhiy-storchaka
serhiy-storchaka https://github.com/serhiy-storchaka
https://github.com/python/cpython/pull/138873/files/4b89325a60dbe9a0f2d807c04c13d9df1a8986d1
Please reload this pagehttps://github.com/python/cpython/pull/138873
skip news https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22skip%20news%22
Please reload this pagehttps://github.com/python/cpython/pull/138873
https://github.com/vstinner
https://github.com/bedevere-bot
https://github.com/skirpichev
https://github.com/serhiy-storchaka
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.