Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-137044: Make resource.RLIM_INFINITY always positive#137511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchakaserhiy-storchaka commentedAug 7, 2025
edited
Loading

It is now a positive integer larger than any limited resource value. This simplifies comparison of the resource values. Previously, it could be negative, such as -1 or -3, depending on platform.

It is now a positive integer larger larger than any limited resource value.This simplifies comparison of the resource values.Previously, it could be negative, such as -1 or -3, depending on platform.
Copy link
Member

@encukouencukou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

OK, let's do this. It's the practical thing to do; if there are platforms that conform to POSIX in more interesting ways then we'll hopefullly notice in the 3.15 cycle.

Comment on lines +1 to +4
:data:`resource.RLIM_INFINITY` is now always a positive integer larger than
any limited resource value. This simplifies comparison of the resource
values. Previously, it could be negative, such as -1 or -3, depending on
platform.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I don't think we test/guarantee thatRLIM_INFINITY is bigger than limited values. AFAIK, POSIX would have no problem withRLIM_INFINITY being zero.
So, this should be:

Suggested change
:data:`resource.RLIM_INFINITY` is now always a positive integer larger than
any limited resource value. This simplifies comparison of the resource
values. Previously, it could be negative, such as -1 or -3, depending on
platform.
:data:`resource.RLIM_INFINITY` is now always a positive integer.
Previously, it could be negative, such as -1 or -3, depending on
platform.

or:

Suggested change
:data:`resource.RLIM_INFINITY` is now always a positive integer larger than
any limited resource value. This simplifies comparison of the resource
values. Previously, it could be negative, such as -1 or -3, depending on
platform.
:data:`resource.RLIM_INFINITY` is now always a positive integer.
On supported platforms, it is larger than any limited resource value,
which simplifies comparison of the resource values.
Previously, it could be negative, such as -1 or -3, depending on
platform.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

https://pubs.opengroup.org/onlinepubs/9799919799/functions/getrlimit.html

The value RLIM_INFINITY, defined in<sys/resource.h>, shall be considered to be larger than any other limit value.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

To be clear, I do not think this should have been merged without this change.

@serhiy-storchakaserhiy-storchaka merged commit0324c72 intopython:mainAug 18, 2025
46 checks passed
@serhiy-storchakaserhiy-storchaka deleted the resource-RLIM_INFINITY branchAugust 18, 2025 16:29
@zware
Copy link
Member

This seems to have brokentest_resource on 32-bit Linux; see for examplehttps://buildbot.python.org/#/builders/1245/builds/6166

FAIL: test_fsize_not_too_big (test.test_resource.ResourceTest.test_fsize_not_too_big)----------------------------------------------------------------------Traceback (most recent call last):  File "/buildbot/buildarea/3.x.ware-debian-x86.nondebug/build/Lib/test/test_resource.py", line 133, in test_fsize_not_too_big    self.assertEqual(resource.getrlimit(resource.RLIMIT_FSIZE), expected(2**32))    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError: Tuples differ: (18446744073709551615, 18446744073709551615) != (4294967296, 18446744073709551615)First differing element 0:184467440737095516154294967296- (18446744073709551615, 18446744073709551615)?  --    ^^^^^^^ --- --+ (4294967296, 18446744073709551615)?   ++ +  ^

@serhiy-storchaka
Copy link
MemberAuthor

Test fix:#137941.

zware reacted with hooray emoji

Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull requestAug 19, 2025
…H-137511)It is now a positive integer larger larger than any limited resource value.This simplifies comparison of the resource values.Previously, it could be negative, such as -1 or -3, depending on platform.Deprecation warning is emitted if the old negative value is passed.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@encukouencukouencukou approved these changes

@AA-TurnerAA-TurnerAwaiting requested review from AA-TurnerAA-Turner is a code owner

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@serhiy-storchaka@zware@encukou

[8]ページ先頭

©2009-2025 Movatter.jp