Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
sys.flags.gil may be None or an int
  • Loading branch information
colesbury committed Aug 1, 2024
commit 7a41cfc68035214762f637a56b30954ebc5f384c
9 changes: 7 additions & 2 deletions Lib/test/test_sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,10 +805,15 @@ def test_sys_flags(self):
"hash_randomization", "isolated", "dev_mode", "utf8_mode",
"warn_default_encoding", "safe_path", "int_max_str_digits",
"gil")
attr_types = {
"dev_mode": bool,
"safe_path": bool,
"gil": (int, type(None)),
Copy link
Copy Markdown
Member

@picnixz picnixz Aug 2, 2024

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?

}
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))

Expand Down