René's URL Explorer Experiment


Title: regression in 3.13.4 `Random.getrandbits` when an `int` like object is passed · Issue #135326 · python/cpython · GitHub

Open Graph Title: regression in 3.13.4 `Random.getrandbits` when an `int` like object is passed · Issue #135326 · python/cpython

X Title: regression in 3.13.4 `Random.getrandbits` when an `int` like object is passed · Issue #135326 · python/cpython

Description: Bug report Bug description: via #133489 (comment) @tornaria reports: There is an (unintended?) api break. In python 3.13.3, getrandbits() accepts an "integer-like" object as in: Python 3.13.3 (main, Apr 11 2025, 13:41:26) [GCC 13.2.0] on...

Open Graph Description: Bug report Bug description: via #133489 (comment) @tornaria reports: There is an (unintended?) api break. In python 3.13.3, getrandbits() accepts an "integer-like" object as in: Python 3.13.3 (main...

X Description: Bug report Bug description: via #133489 (comment) @tornaria reports: There is an (unintended?) api break. In python 3.13.3, getrandbits() accepts an "integer-like" object as in: Python 3....

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"regression in 3.13.4 `Random.getrandbits` when an `int` like object is passed","articleBody":"# Bug report\n\n### Bug description:\n\nvia https://github.com/python/cpython/issues/133489#issuecomment-2954448300 @tornaria reports:\n\nThere is an (unintended?) api break. In python 3.13.3, `getrandbits()` accepts an \"integer-like\" object as in:\n```\nPython 3.13.3 (main, Apr 11 2025, 13:41:26) [GCC 13.2.0] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import random ; r = random.Random()\n>>> from numpy import int64\n>>> r.getrandbits(int64(20))\n582096\n```\nbut in python 3.13.4, `getrandbits()` fails as in:\n```\nPython 3.13.4 (main, Jun  8 2025, 19:43:01) [GCC 14.2.1 20250405] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import random ; r = random.Random()\n>>> from numpy import int64\n>>> r.getrandbits(int64(20))\nTraceback (most recent call last):\n  File \"\u003cpython-input-2>\", line 1, in \u003cmodule>\n    r.getrandbits(int64(20))\n    ~~~~~~~~~~~~~^^^^^^^^^^^\nTypeError: an integer is required\n```\nThis causes trouble for sagemath, where integers are by default a special type `ZZ`. \n\n### CPython versions tested on:\n\n3.13\n\n### Operating systems tested on:\n\n_No response_\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-135327\n* gh-135332\n* gh-135356\n* gh-135373\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/gpshead","@type":"Person","name":"gpshead"},"datePublished":"2025-06-10T04:38:18Z","url":"https://github.com/python/cpython/issues/135326"}

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:9def28a0-c9a7-4629-a89c-9ccd3dbadaac
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id94CE:14EB6E:12C43FB:18B6965:6B01E84A
html-safe-nonce09dca84d1179c65d7a5d617c9e0bc42de9556826f26b15e0da47a66d34f6f8c5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NENFOjE0RUI2RToxMkM0M0ZCOjE4QjY5NjU6NkIwMUU4NEEiLCJ2aXNpdG9yX2lkIjoiMzgyMzA1NDI2MTQ1Mzk3MzU3OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac34be852adfc0d1f18bdbea290363770a68b73036d9e4eb0f33b90ea7747a9c95
hovercard-subject-tagissue:3132115463
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/135326/issue_layout
twitter:imagehttps://opengraph.githubassets.com/6fbf708b80cc33bba046fcbdbba07369bebf0911752bb834ac12a971b00f8bbe/python/cpython/issues/135326
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/6fbf708b80cc33bba046fcbdbba07369bebf0911752bb834ac12a971b00f8bbe/python/cpython/issues/135326
og:image:altBug report Bug description: via #133489 (comment) @tornaria reports: There is an (unintended?) api break. In python 3.13.3, getrandbits() accepts an "integer-like" object as in: Python 3.13.3 (main...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamegpshead
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/135326#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F135326
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%2F135326
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/135326
Reloadhttps://github.com/python/cpython/issues/135326
Reloadhttps://github.com/python/cpython/issues/135326
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/135326
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/135326
regression in 3.13.4 Random.getrandbits when an int like object is passedhttps://github.com/python/cpython/issues/135326#top
https://github.com/gpshead
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
release-blockerhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22release-blocker%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/gpshead
gpsheadhttps://github.com/gpshead
on Jun 10, 2025https://github.com/python/cpython/issues/135326#issue-3132115463
#133489 (comment)https://github.com/python/cpython/issues/133489#issuecomment-2954448300
@tornariahttps://github.com/tornaria
[3.13] gh-135326: Revert "[3.13] gh-133489: Remove size restrictions on getrandbits() and randbytes() (GH-133658) (GH-134965) #135327https://github.com/python/cpython/pull/135327
[3.13] gh-135326: Restore support of __index__ in random.getrandbits() #135332https://github.com/python/cpython/pull/135332
gh-135326: Test support of __index__ in random.getrandbits() #135356https://github.com/python/cpython/pull/135356
[3.14] gh-135326: Test support of __index__ in random.getrandbits() (GH-135356) #135373https://github.com/python/cpython/pull/135373
gpsheadhttps://github.com/gpshead
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
on Jun 10, 2025https://github.com/python/cpython/issues/135326#event-18066754826
gpsheadhttps://github.com/gpshead
on Jun 10, 2025https://github.com/python/cpython/issues/135326#event-18066760509
gpsheadhttps://github.com/gpshead
on Jun 10, 2025https://github.com/python/cpython/issues/135326#event-18066824665
pythongh-135326: Revert "[3.13] pythongh-133489: Remove size restrict…https://github.com/gpshead/cpython/commit/f2585646fe3a4a4d8d1ac3c9c03248165c24db1a
pythongh-135326https://github.com/python/cpython/issues/135326
pythongh-133489https://github.com/python/cpython/issues/133489
f258564https://github.com/gpshead/cpython/commit/f2585646fe3a4a4d8d1ac3c9c03248165c24db1a
gpsheadhttps://github.com/gpshead
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
release-blockerhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22release-blocker%22
on Jun 10, 2025https://github.com/python/cpython/issues/135326#event-18066901694
ezio-melottihttps://github.com/ezio-melotti
Release and Deferred blockers 🚫https://github.com/orgs/python/projects/2
on Jun 10, 2025https://github.com/python/cpython/issues/135326#event-18066904689
github-project-automationhttps://github.com/apps/github-project-automation
Release and Deferred blockers 🚫https://github.com/orgs/python/projects/2
on Jun 10, 2025https://github.com/python/cpython/issues/135326
https://github.com/gpshead
gpsheadhttps://github.com/gpshead
on Jun 10, 2025https://github.com/python/cpython/issues/135326#issuecomment-2957686635
gpsheadhttps://github.com/gpshead
on Jun 10, 2025https://github.com/python/cpython/issues/135326#event-18066963144
serhiy-storchakahttps://github.com/serhiy-storchaka
on Jun 10, 2025https://github.com/python/cpython/issues/135326#event-18068338055
[3.13] pythongh-135326: Restore support of __index__ in random.getran…https://github.com/serhiy-storchaka/cpython/commit/874a075f0f031eb02aa0eb1e5609ca20a312fca4
pythongh-135326https://github.com/python/cpython/issues/135326
874a075https://github.com/serhiy-storchaka/cpython/commit/874a075f0f031eb02aa0eb1e5609ca20a312fca4
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on Jun 10, 2025https://github.com/python/cpython/issues/135326#issuecomment-2957916594
#135332https://github.com/python/cpython/pull/135332
Yhg1shttps://github.com/Yhg1s
on Jun 10, 2025https://github.com/python/cpython/issues/135326#event-18072472953
[3.13] gh-135326: Restore support of __index__ in random.getrandbits() (https://github.com/python/cpython/commit/37027ab535d13462e1708e1e897a38960164d505
gh-135326https://github.com/python/cpython/issues/135326
37027abhttps://github.com/python/cpython/commit/37027ab535d13462e1708e1e897a38960164d505
serhiy-storchakahttps://github.com/serhiy-storchaka
on Jun 10, 2025https://github.com/python/cpython/issues/135326#event-18079821920
pythongh-135326: Test support of __index__ in random.getrandbits()https://github.com/serhiy-storchaka/cpython/commit/207d1d0104cbd3c63b14901d244dbe71c56f377a
pythongh-135326https://github.com/python/cpython/issues/135326
207d1d0https://github.com/serhiy-storchaka/cpython/commit/207d1d0104cbd3c63b14901d244dbe71c56f377a
gpsheadhttps://github.com/gpshead
on Jun 11, 2025https://github.com/python/cpython/issues/135326#event-18085133024
gh-135326: Test support of __index__ in random.getrandbits() (#135356)https://github.com/python/cpython/commit/5ae669fc4e674968529cc32f7f31d14dddd76607
gh-135326https://github.com/python/cpython/issues/135326
#135356https://github.com/python/cpython/pull/135356
5ae669fhttps://github.com/python/cpython/commit/5ae669fc4e674968529cc32f7f31d14dddd76607
miss-islingtonhttps://github.com/miss-islington
on Jun 11, 2025https://github.com/python/cpython/issues/135326#event-18085133982
pythongh-135326: Test support of __index__ in random.getrandbits() (p…https://github.com/miss-islington/cpython/commit/55e85ae54477c5dc7187de308fbf2c79a1c5cfd0
pythongh-135326https://github.com/python/cpython/issues/135326
p…https://github.com/python/cpython/pull/135356
55e85aehttps://github.com/miss-islington/cpython/commit/55e85ae54477c5dc7187de308fbf2c79a1c5cfd0
https://github.com/gpshead
gpsheadhttps://github.com/gpshead
on Jun 11, 2025https://github.com/python/cpython/issues/135326#issuecomment-2960991647
gpsheadhttps://github.com/gpshead
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jun 11, 2025https://github.com/python/cpython/issues/135326#event-18085140201
github-project-automationhttps://github.com/apps/github-project-automation
Release and Deferred blockers 🚫https://github.com/orgs/python/projects/2
on Jun 11, 2025https://github.com/python/cpython/issues/135326
gpsheadhttps://github.com/gpshead
on Jun 11, 2025https://github.com/python/cpython/issues/135326#event-18085348433
[3.14] gh-135326: Test support of __index__ in random.getrandbits() (G…https://github.com/python/cpython/commit/9f6c3769e348283d3c2af8d4e7a5792f9c0f7153
gh-135326https://github.com/python/cpython/issues/135326
G…https://github.com/python/cpython/pull/135356
9f6c376https://github.com/python/cpython/commit/9f6c3769e348283d3c2af8d4e7a5792f9c0f7153
tornariahttps://github.com/tornaria
on Jun 11, 2025https://github.com/python/cpython/issues/135326#event-18085979339
python3: fix a regressionhttps://github.com/tornaria/void-packages/commit/06647e30b3ad6a0f693627ca2d77ea156156cd61
06647e3https://github.com/tornaria/void-packages/commit/06647e30b3ad6a0f693627ca2d77ea156156cd61
ahesfordhttps://github.com/ahesford
on Jun 11, 2025https://github.com/python/cpython/issues/135326#event-18091211168
python3: fix a regressionhttps://github.com/void-linux/void-packages/commit/fff3c45f6bd542fc22ba2d1959d10be450d39cbc
fff3c45https://github.com/void-linux/void-packages/commit/fff3c45f6bd542fc22ba2d1959d10be450d39cbc
lkollarhttps://github.com/lkollar
on Jun 19, 2025https://github.com/python/cpython/issues/135326#event-18236448015
pythongh-135326: Test support of __index__ in random.getrandbits() (p…https://github.com/lkollar/cpython/commit/d44ab1ee89b009142493065b621ce95f4320594c
pythongh-135326https://github.com/python/cpython/issues/135326
p…https://github.com/python/cpython/pull/135356
d44ab1ehttps://github.com/lkollar/cpython/commit/d44ab1ee89b009142493065b621ce95f4320594c
sww1235https://github.com/sww1235
on Jun 29, 2025https://github.com/python/cpython/issues/135326#event-18372317684
python3: fix a regressionhttps://github.com/sww1235/void-packages/commit/f74b64f1abe5de09c59868824d7d7ac9affcc3db
f74b64fhttps://github.com/sww1235/void-packages/commit/f74b64f1abe5de09c59868824d7d7ac9affcc3db
Pranjal095https://github.com/Pranjal095
on Jul 12, 2025https://github.com/python/cpython/issues/135326#event-18600178862
pythongh-135326: Test support of __index__ in random.getrandbits() (p…https://github.com/Pranjal095/cpython/commit/dd7014832ef67bd7ac622ddd18ef7d605bf5a23c
pythongh-135326https://github.com/python/cpython/issues/135326
p…https://github.com/python/cpython/pull/135356
dd70148https://github.com/Pranjal095/cpython/commit/dd7014832ef67bd7ac622ddd18ef7d605bf5a23c
taegyunkimhttps://github.com/taegyunkim
on Aug 4, 2025https://github.com/python/cpython/issues/135326#event-18976835504
pythongh-135326: Test support of __index__ in random.getrandbits() (p…https://github.com/taegyunkim/cpython/commit/aa3f2f477ca4d00b7ee3157fb96883bfc06dd097
pythongh-135326https://github.com/python/cpython/issues/135326
p…https://github.com/python/cpython/pull/135356
aa3f2f4https://github.com/taegyunkim/cpython/commit/aa3f2f477ca4d00b7ee3157fb96883bfc06dd097
Agent-Hellboyhttps://github.com/Agent-Hellboy
on Aug 19, 2025https://github.com/python/cpython/issues/135326#event-19221795957
pythongh-135326: Test support of __index__ in random.getrandbits() (p…https://github.com/Agent-Hellboy/cpython/commit/a606e7835e8cb1e6e6904f6c3f005c3eee22d284
pythongh-135326https://github.com/python/cpython/issues/135326
p…https://github.com/python/cpython/pull/135356
a606e78https://github.com/Agent-Hellboy/cpython/commit/a606e7835e8cb1e6e6904f6c3f005c3eee22d284
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/135326
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/135326
gpsheadhttps://github.com/gpshead
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
release-blockerhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22release-blocker%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
Release and Deferred blockers 🚫https://github.com/orgs/python/projects/2
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.