-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-122575: Include sys.flags.gil
as a sequence attribute
#122576
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
Conversation
Make sure that `sys.flags.gil` is included when `sys.flags` is treated as a tuple or named tuple.
@ericsnowcurrently, when you have some time, I'd appreciate your review on this |
@@ -587,6 +587,9 @@ always available. | |||
* - .. attribute:: flags.warn_default_encoding | |||
- :option:`-X warn_default_encoding <-X>` | |||
|
|||
* - .. attribute:: flags.gil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should explain that the gil takes values 0, 1, or 2 and possibly explain the corresponding values (or a link to them) (and also say that None means the free-threaded build (if I'm not wrong)).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't the right place for that, is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh actually I don't really know where it would be the right place... I just wanted to point it out since a new variable is being documented (I don't know whether there already exists another place so feel free to ignore this comment!)
attr_types = { | ||
"dev_mode": bool, | ||
"safe_path": bool, | ||
"gil": (int, type(None)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the None value mean that it's the free-threaded build or is it for something else?
Potentially, .. data:: flags
The :term:`named tuple` *flags* exposes the status of command line
flags. The attributes are read only.
+ The number of flags may change in any version of Python,
+ do not unpack ``sys.flags`` or index into it as a tuple. which would document that we change A |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if you apply the Py_ARRAY_LENGTH() suggestion.
Co-authored-by: Bénédikt Tran <[email protected]>
Ah, you should now update test_pythontypes() of test_sys. |
I'm going to close this for now as @encukou expressed concerns about backwards compatibility on the issue: #122575 (comment) |
Make sure that
sys.flags.gil
is included whensys.flags
is treated as a tuple or named tuple.sys.flags.gil
should be a "sequence" attribute #122575📚 Documentation preview 📚: https://cpython-previews--122576.org.readthedocs.build/en/122576/library/sys.html#sys.flags