René's URL Explorer Experiment


Title: resource library (getrlimit, setrlimit) interprets resource limits as signed integers instead of unsigned · Issue #137044 · python/cpython · GitHub

Open Graph Title: resource library (getrlimit, setrlimit) interprets resource limits as signed integers instead of unsigned · Issue #137044 · python/cpython

X Title: resource library (getrlimit, setrlimit) interprets resource limits as signed integers instead of unsigned · Issue #137044 · python/cpython

Description: Bug report Bug description: as per System Calls Manual (man 2 setrlimit), rlim_t is an unsigned integer type in Python, reading the default hard limit (resource.getrlimit(resource.RLIMIT_CPU)) will return -1 executing this: resource.setr...

Open Graph Description: Bug report Bug description: as per System Calls Manual (man 2 setrlimit), rlim_t is an unsigned integer type in Python, reading the default hard limit (resource.getrlimit(resource.RLIMIT_CPU)) will...

X Description: Bug report Bug description: as per System Calls Manual (man 2 setrlimit), rlim_t is an unsigned integer type in Python, reading the default hard limit (resource.getrlimit(resource.RLIMIT_CPU)) will...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"resource library (getrlimit, setrlimit) interprets resource limits as signed integers instead of unsigned","articleBody":"# Bug report\n\n### Bug description:\n\n* as per System Calls Manual (`man 2 setrlimit`), `rlim_t` is an **unsigned** integer type\n* in Python, reading the default hard limit (`resource.getrlimit(resource.RLIMIT_CPU)`) will return `-1`\n* executing this:\n\n``` python3\nresource.setrlimit(resource.RLIMIT_CPU, (-2, -2))\nos.system(\"ulimit -t\")\n```\nreturns `18446744073709551614`\n * executing `ulimit -t 18446744073709551614`, then in python3 `resource.getrlimit(resource.RLIMIT_CPU)`, will return `-2`\n\nThis behaviour is very weird and will cause the following rather useful and common snippet to fail:\n``` python3\n_, hardlimit = resource.getrlimit(resource.RLIMIT_CPU)\nrlimit = (min(timelimit, hardlimit), hardlimit)\nresource.setrlimit(resource.RLIMIT_CPU, rlimit)\n```\n\nThere happens to exist the following workaround:\n``` python3\n_, hardlimit = resource.getrlimit(resource.RLIMIT_CPU)\nsoftlimit = ctypes.c_long(min(seconds, ctypes.c_ulong(hardlimit).value)).value\nrlimit = (softlimit, hardlimit)\nresource.setrlimit(resource.RLIMIT_CPU, rlimit)\n```\nbut it just feels extremely hacky to do things like this and I believe a lot of programmers end in this trap.\nEspecially that when you handle the `-1` case specially (as it is mentioned in man, that \"RLIM_INFINITY typically is the same as -1\"), it still fails with other negative values like `-2`.\n\n### CPython versions tested on:\n\n3.15\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-137338\n* gh-137506\n* gh-137507\n* gh-137511\n* gh-137938\n* gh-137941\n* gh-137954\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/ArturBieniek4","@type":"Person","name":"ArturBieniek4"},"datePublished":"2025-07-23T14:12:08Z","url":"https://github.com/python/cpython/issues/137044"}

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:36b40607-bdfc-6f79-b4f6-7a347ef48bd9
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAEC8:A71F9:36034DC:445A180:6B021B67
html-safe-nonce89ee102fe289b6d8e742a16bbf92b4c037b8b3c81bf6040384daa5db3d959cc6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRUM4OkE3MUY5OjM2MDM0REM6NDQ1QTE4MDo2QjAyMUI2NyIsInZpc2l0b3JfaWQiOiI0NTY2NzU5NjczNDQxODgyNjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaca9c64b11bbd982823bd5fdedf7ad265c3f4a3d7b18a502f2c5b678a4c4867128
hovercard-subject-tagissue:3256561701
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/137044/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3fce99111a56873c31b80cab7c31c52229ac654e74ddbc1cea34bf73f59ee417/python/cpython/issues/137044
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3fce99111a56873c31b80cab7c31c52229ac654e74ddbc1cea34bf73f59ee417/python/cpython/issues/137044
og:image:altBug report Bug description: as per System Calls Manual (man 2 setrlimit), rlim_t is an unsigned integer type in Python, reading the default hard limit (resource.getrlimit(resource.RLIMIT_CPU)) will...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameArturBieniek4
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-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/137044#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F137044
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%2F137044
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/137044
Reloadhttps://github.com/python/cpython/issues/137044
Reloadhttps://github.com/python/cpython/issues/137044
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/137044
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/137044
resource library (getrlimit, setrlimit) interprets resource limits as signed integers instead of unsignedhttps://github.com/python/cpython/issues/137044#top
https://github.com/serhiy-storchaka
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/ArturBieniek4
ArturBieniek4https://github.com/ArturBieniek4
on Jul 23, 2025https://github.com/python/cpython/issues/137044#issue-3256561701
gh-137044: Support large limit values in getrlimit() and setrlimit() #137338https://github.com/python/cpython/pull/137338
[3.14] gh-137044: Support large limit values in getrlimit() and setrlimit() (GH-137338) #137506https://github.com/python/cpython/pull/137506
[3.13] gh-137044: Support large limit values in getrlimit() and setrlimit() (GH-137338) #137507https://github.com/python/cpython/pull/137507
gh-137044: Make resource.RLIM_INFINITY always positive #137511https://github.com/python/cpython/pull/137511
gh-137044: Revert "gh-137044: Make resource.RLIM_INFINITY always positive (GH-137511)" #137938https://github.com/python/cpython/pull/137938
gh-137044: Fix test_resource on 32-bit Linux #137941https://github.com/python/cpython/pull/137941
gh-137044: To weaken the statement regarding the RLIM_INFINITY value #137954https://github.com/python/cpython/pull/137954
Nexthttps://github.com/python/cpython/issues/137044?timeline_page=1
ArturBieniek4https://github.com/ArturBieniek4
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
on Jul 23, 2025https://github.com/python/cpython/issues/137044#event-18775540638
aiskhttps://github.com/aisk
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
on Jul 23, 2025https://github.com/python/cpython/issues/137044#event-18775871110
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on Jul 23, 2025https://github.com/python/cpython/issues/137044#issuecomment-3109084290
serhiy-storchakahttps://github.com/serhiy-storchaka
on Jul 23, 2025https://github.com/python/cpython/issues/137044#event-18777585780
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on Jul 23, 2025https://github.com/python/cpython/issues/137044#issuecomment-3109189943
serhiy-storchakahttps://github.com/serhiy-storchaka
on Aug 3, 2025https://github.com/python/cpython/issues/137044#event-18956868124
pythongh-137044: Support large limit values in getrlimit() and setrli…https://github.com/serhiy-storchaka/cpython/commit/3ad0cf0271141d92d69a9c70114f7ade66713c30
pythongh-137044https://github.com/python/cpython/issues/137044
3ad0cf0https://github.com/serhiy-storchaka/cpython/commit/3ad0cf0271141d92d69a9c70114f7ade66713c30
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on Aug 3, 2025https://github.com/python/cpython/issues/137044#issuecomment-3148329380
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on Aug 6, 2025https://github.com/python/cpython/issues/137044#issuecomment-3161069524
serhiy-storchakahttps://github.com/serhiy-storchaka
on Aug 7, 2025https://github.com/python/cpython/issues/137044#event-19029666861
gh-137044: Support large limit values in getrlimit() and setrlimit() (G…https://github.com/python/cpython/commit/baefaa6cba1d69efd2f930cdc56bca682c54b139
gh-137044https://github.com/python/cpython/issues/137044
G…https://github.com/python/cpython/pull/137338
baefaa6https://github.com/python/cpython/commit/baefaa6cba1d69efd2f930cdc56bca682c54b139
miss-islingtonhttps://github.com/miss-islington
on Aug 7, 2025https://github.com/python/cpython/issues/137044#event-19029668598
pythongh-137044: Support large limit values in getrlimit() and setrli…https://github.com/miss-islington/cpython/commit/90f14373d6d59e0d5ebc89129f4893edba796091
pythongh-137044https://github.com/python/cpython/issues/137044
90f1437https://github.com/miss-islington/cpython/commit/90f14373d6d59e0d5ebc89129f4893edba796091
pythongh-137044: Support large limit values in getrlimit() and setrli…https://github.com/miss-islington/cpython/commit/64abcc305077b07ad437b8543612b7fc01ad53cc
pythongh-137044https://github.com/python/cpython/issues/137044
64abcc3https://github.com/miss-islington/cpython/commit/64abcc305077b07ad437b8543612b7fc01ad53cc
serhiy-storchakahttps://github.com/serhiy-storchaka
on Aug 7, 2025https://github.com/python/cpython/issues/137044#event-19031346044
pythongh-137044: Make resource.RLIM_INFINITY always positivehttps://github.com/serhiy-storchaka/cpython/commit/8b7868292f3379e2f7f1ff0a1aee09511e0e6db4
pythongh-137044https://github.com/python/cpython/issues/137044
8b78682https://github.com/serhiy-storchaka/cpython/commit/8b7868292f3379e2f7f1ff0a1aee09511e0e6db4
[3.13] gh-137044: Support large limit values in getrlimit() and setrl…https://github.com/python/cpython/commit/8905f7a99bd9c2851bec9db1d09bc4e1820b5f7d
gh-137044https://github.com/python/cpython/issues/137044
8905f7ahttps://github.com/python/cpython/commit/8905f7a99bd9c2851bec9db1d09bc4e1820b5f7d
https://github.com/encukou
encukouhttps://github.com/encukou
on Aug 7, 2025https://github.com/python/cpython/issues/137044#issuecomment-3163993181
https://github.com/ArturBieniek4
ArturBieniek4https://github.com/ArturBieniek4
on Aug 7, 2025https://github.com/python/cpython/issues/137044#issuecomment-3164078320
encukouhttps://github.com/encukou
on Aug 19, 2025https://github.com/python/cpython/issues/137044#event-19218004021
Revert "pythongh-137044: Make resource.RLIM_INFINITY always positive (p…https://github.com/encukou/cpython/commit/6b8dc492644303b79e94cdc7783f23af2ffc0753
pythongh-137044https://github.com/python/cpython/issues/137044
p…https://github.com/python/cpython/pull/137511
6b8dc49https://github.com/encukou/cpython/commit/6b8dc492644303b79e94cdc7783f23af2ffc0753
serhiy-storchakahttps://github.com/serhiy-storchaka
on Aug 19, 2025https://github.com/python/cpython/issues/137044#event-19219123852
pythongh-137044: Fix test_resource on 32-bit Linuxhttps://github.com/serhiy-storchaka/cpython/commit/8eec07bcfb78a1573f54ee9aa5eb0f2374138a46
pythongh-137044https://github.com/python/cpython/issues/137044
8eec07bhttps://github.com/serhiy-storchaka/cpython/commit/8eec07bcfb78a1573f54ee9aa5eb0f2374138a46
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on Aug 19, 2025https://github.com/python/cpython/issues/137044#issuecomment-3199732350
https://github.com/encukou
encukouhttps://github.com/encukou
on Aug 19, 2025https://github.com/python/cpython/issues/137044#issuecomment-3199810826
https://github.com/ArturBieniek4
ArturBieniek4https://github.com/ArturBieniek4
on Aug 19, 2025https://github.com/python/cpython/issues/137044#issuecomment-3199827790
https://github.com/encukou
encukouhttps://github.com/encukou
on Aug 19, 2025https://github.com/python/cpython/issues/137044#issuecomment-3199852987
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on Aug 19, 2025https://github.com/python/cpython/issues/137044#issuecomment-3199890652
Agent-Hellboyhttps://github.com/Agent-Hellboy
on Aug 19, 2025https://github.com/python/cpython/issues/137044#event-19221823044
pythongh-137044: Support large limit values in getrlimit() and setrli…https://github.com/Agent-Hellboy/cpython/commit/eaf36dd2a62745bc58074d255e96658f960d369e
pythongh-137044https://github.com/python/cpython/issues/137044
eaf36ddhttps://github.com/Agent-Hellboy/cpython/commit/eaf36dd2a62745bc58074d255e96658f960d369e
pythongh-137044: Make resource.RLIM_INFINITY always positive (pythonG…https://github.com/Agent-Hellboy/cpython/commit/494e0b9101c854956f3a521b5ea6ac0d17d20df2
pythongh-137044https://github.com/python/cpython/issues/137044
pythonG…https://github.com/python/cpython/pull/137511
494e0b9https://github.com/Agent-Hellboy/cpython/commit/494e0b9101c854956f3a521b5ea6ac0d17d20df2
serhiy-storchakahttps://github.com/serhiy-storchaka
on Aug 19, 2025https://github.com/python/cpython/issues/137044#event-19223580205
gh-137044: Fix test_resource on 32-bit Linux (GH-137941)https://github.com/python/cpython/commit/ac37b77441d628df6fa3eb41f040a7c60cb166ec
gh-137044https://github.com/python/cpython/issues/137044
GH-137941https://github.com/python/cpython/pull/137941
ac37b77https://github.com/python/cpython/commit/ac37b77441d628df6fa3eb41f040a7c60cb166ec
pythongh-137044: To weaken the statement regarding the RLIM_INFINITY …https://github.com/serhiy-storchaka/cpython/commit/7c3baff1455c442ba63fc2e1c0a23f8d47dd1a61
pythongh-137044https://github.com/python/cpython/issues/137044
7c3baffhttps://github.com/serhiy-storchaka/cpython/commit/7c3baff1455c442ba63fc2e1c0a23f8d47dd1a61
gh-137044: To weaken the statement regarding the RLIM_INFINITY value (G…https://github.com/python/cpython/commit/23adbf53c5b1d614c326c27bdc379ff6a775e8fe
gh-137044https://github.com/python/cpython/issues/137044
G…https://github.com/python/cpython/pull/137954
23adbf5https://github.com/python/cpython/commit/23adbf53c5b1d614c326c27bdc379ff6a775e8fe
serhiy-storchakahttps://github.com/serhiy-storchaka
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Sep 16, 2025https://github.com/python/cpython/issues/137044#event-19731117817
vstinnerhttps://github.com/vstinner
on Oct 7, 2025https://github.com/python/cpython/issues/137044#event-20147436838
[3.14] gh-137044: Support large limit values in getrlimit() and setrl…https://github.com/python/cpython/commit/c4be405fe98e2e6176475c87d12ddf9668e8dda2
gh-137044https://github.com/python/cpython/issues/137044
c4be405https://github.com/python/cpython/commit/c4be405fe98e2e6176475c87d12ddf9668e8dda2
giampaolohttps://github.com/giampaolo
on Nov 8, 2026https://github.com/python/cpython/issues/137044#event-35516320544
Make `RLIM_INFINITY` match `resource.RLIM_INFINITY` (#3110)https://github.com/giampaolo/psutil/commit/729154f7c5d471265eb93b0d1ca1db9267f0b7af
#3110https://github.com/giampaolo/psutil/pull/3110
729154fhttps://github.com/giampaolo/psutil/commit/729154f7c5d471265eb93b0d1ca1db9267f0b7af
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/137044
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/137044
serhiy-storchakahttps://github.com/serhiy-storchaka
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%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.