-
-
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -803,11 +803,17 @@ def test_sys_flags(self): | |
"dont_write_bytecode", "no_user_site", "no_site", | ||
"ignore_environment", "verbose", "bytes_warning", "quiet", | ||
"hash_randomization", "isolated", "dev_mode", "utf8_mode", | ||
"warn_default_encoding", "safe_path", "int_max_str_digits") | ||
"warn_default_encoding", "safe_path", "int_max_str_digits", | ||
"gil") | ||
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 commentThe 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? |
||
} | ||
for attr in attrs: | ||
self.assertTrue(hasattr(sys.flags, attr), attr) | ||
attr_type = bool if attr in ("dev_mode", "safe_path") else int | ||
self.assertEqual(type(getattr(sys.flags, attr)), attr_type, attr) | ||
expected_type = attr_types.get(attr, int) | ||
self.assertIsInstance(getattr(sys.flags, attr), expected_type, attr) | ||
self.assertTrue(repr(sys.flags)) | ||
self.assertEqual(len(sys.flags), len(attrs)) | ||
|
||
|
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/Core_and_Builtins/2024-08-01-18-35-54.gh-issue-122575.JTvKx9.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Include :attr:`sys.flags.gil` as part of the sequence when :data:`sys.flags` | ||
is treated as a tuple. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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!)