Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Availbility of resource constants not properly documented #116218

Closed
solsword opened this issue Mar 1, 2024 · 5 comments
Closed

Availbility of resource constants not properly documented #116218

solsword opened this issue Mar 1, 2024 · 5 comments
Labels
docs Documentation in the Doc dir

Comments

@solsword
Copy link

solsword commented Mar 1, 2024

Documentation

In the docs for the 'resource' module, RLIMIT_VMEM does not have any availability notes, however, on my system (Python 3.11.7 on ArchLinux virtualized under WSL) RLIMIT_VMEM is not defined. I see:

Python 3.11.7 (main, Jan 29 2024, 16:03:57) [GCC 13.2.1 20230801] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import resource as r
>>> dir(r)
['RLIMIT_AS', 'RLIMIT_CORE', 'RLIMIT_CPU', 'RLIMIT_DATA', 'RLIMIT_FSIZE', 'RLIMIT_MEMLOCK', 'RLIMIT_MSGQUEUE', 'RLIMIT_NICE', 'RLIMIT_NOFILE', 'RLIMIT_NPROC', 'RLIMIT_OFILE', 'RLIMIT_RSS', 'RLIMIT_RTPRIO', 'RLIMIT_RTTIME', 'RLIMIT_SIGPENDING', 'RLIMIT_STACK', 'RLIM_INFINITY', 'RUSAGE_CHILDREN', 'RUSAGE_SELF', 'RUSAGE_THREAD', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'error', 'getpagesize', 'getrlimit', 'getrusage', 'prlimit', 'setrlimit', 'struct_rusage']

Not sure which systems RLIMIT_VMEM is available on, but that should probably be mentioned.

Linked PRs

@solsword solsword added the docs Documentation in the Doc dir label Mar 1, 2024
@Privat33r-dev
Copy link
Contributor

Privat33r-dev commented Mar 1, 2024

The issue was raised earlier https://bugs.python.org/issue40772 #84949 But thanks for reporting, we share the common cause to make cpython better :)

From what I could find, it's available only in FreeBSD (where it's just an alias for RLIMIT_AS), but not in a standard systemd or POSIX (please, correct me if I am wrong, not an OS expert :) ).

@erlend-aasland maybe the documentation could be improved if we just add that it's an alias to RLIMIT_AS on FreeBSD? It could potentially resolve the confusion.

@erlend-aasland
Copy link
Contributor

@Privat33r-dev I think we should start with adding availability annotations to those constants in the docs.

@solsword
Copy link
Author

solsword commented Mar 2, 2024

My bad! I did a search for RLIMIT_VMEM on this tracker before posting, but I guess that wasn't thorough enough! (okay I just verified the default search includes "is:open" which was the problem. Indeed I didn't read the disclaimer mentioned in the other report carefully enough, but there are other constants that have explicit availability notes about FreeBSD, so it seems like this one should have that too? If it's useful I can probably figure out submitting a pull request for that label?

@Privat33r-dev
Copy link
Contributor

Privat33r-dev commented Mar 2, 2024

My bad! I did a search for RLIMIT_VMEM on this tracker before posting, but I guess that wasn't thorough enough!

No problem, we are all humans and it's absolutely normal, I have 2 issues that are irrelevant :)

If it's useful I can probably figure out submitting a pull request for that label?

Sure, why not. Contributions are welcome.

A few useful links for you:
General advice about contributing to Docs
How to build and test docs

@Privat33r-dev
Copy link
Contributor

@Privat33r-dev I think we should start with adding availability annotations to those constants in the docs.

I made a little research. It appears that most of the availability params are taken from man(7) pages, while at the same time they don't cover some constants. Turns out, they are even deeper than linux repo on Github posted by Linus, as some constants' history (e.g. RLIMIT_AS) go to version 1.3.0 (include/asm-alpha/resource.h file).

I guess that you didn't mean to check that deeply, but as a result we can add annotation to many (if not all) the constants.

ronaldoussoren pushed a commit that referenced this issue Mar 9, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 9, 2024
… module (pythonGH-116256)

Add availability data to 'resource' module Docs
(cherry picked from commit 03f86b1)

Co-authored-by: Kerim Kabirov <39376984+Privat33r-dev@users.noreply.github.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 9, 2024
… module (pythonGH-116256)

Add availability data to 'resource' module Docs
(cherry picked from commit 03f86b1)

Co-authored-by: Kerim Kabirov <39376984+Privat33r-dev@users.noreply.github.com>
ronaldoussoren pushed a commit that referenced this issue Mar 9, 2024
…' module (GH-116256) (#116533)

GH-116218 Docs: Add availability information for the 'resource' module (GH-116256)

Add availability data to 'resource' module Docs
(cherry picked from commit 03f86b1)

Co-authored-by: Kerim Kabirov <39376984+Privat33r-dev@users.noreply.github.com>
ronaldoussoren pushed a commit that referenced this issue Mar 9, 2024
…' module (GH-116256) (#116534)

GH-116218 Docs: Add availability information for the 'resource' module (GH-116256)

Add availability data to 'resource' module Docs
(cherry picked from commit 03f86b1)

Co-authored-by: Kerim Kabirov <39376984+Privat33r-dev@users.noreply.github.com>
adorilson pushed a commit to adorilson/cpython that referenced this issue Mar 25, 2024
… module (python#116256)

Add availability data to 'resource' module Docs
diegorusso pushed a commit to diegorusso/cpython that referenced this issue Apr 17, 2024
… module (python#116256)

Add availability data to 'resource' module Docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

4 participants