-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
sys.flags.gil
should be a "sequence" attribute
#122575
Comments
Make sure that `sys.flags.gil` is included when `sys.flags` is treated as a tuple or named tuple.
Generally, changing |
That seems like an entirely hypothetical concern. As you wrote, I don't think anyone unpacks the 18 or 19 elements of This is the only
I don't think so. These are publicly documented as "named tuples" and named tuples do not support this feature of attributes that are only accessible by name. |
Here's what I think. Perhaps this needs wider discussion.
That's not the case:
Sadly, yes. The security fix didn't go through public review.
Note that the whole concept name-only attributes was added to Sadly, the user-facing documentation for creating these types doesn't mention how they should be used in stdlib. |
Thanks, I misinterpreted what I saw in gh-122577 and missed that.
We've added flags over a dozen times before that. Every time we've updated If you want to implement this differently, that's fine with me, but I think it's a waste of time. |
Over the last years, many flags were added to sys.flags and I don't recall a single bug report. I'm convinced that nobody is unpacking |
Unfortunately I haven't had time to dig deeper. Don't take my concern too seriously. |
Python 3.13.0 is now shipped without
|
IMO we should deprecate the tuple API for Good example:
Bad example:
|
Bug report
sys.flags
is aPyStructSequence
.PyStructSequence
is similar to a named tuple, but it can have attributes that are not part of the sequence.Currently,
sys.flags.gil
is not a "sequence" attribute:I think this was an oversight. We forgot to update the
n_in_sequence
field from 18 to 19 in gh-116338:cpython/Python/sysmodule.c
Lines 3123 to 3128 in fda6bd8
Linked PRs
sys.flags.gil
as a sequence attribute #122576The text was updated successfully, but these errors were encountered: