gh-107954: Add PyConfig_MEMBER_BOOL type to PyConfigSpec (#116359)

_PyConfig_AsDict() now returns bool objects for options using the new
PyConfig_MEMBER_BOOL type.

Update tests for these changes.
This commit is contained in:
Victor Stinner 2024-03-06 10:29:27 +01:00 committed by GitHub
parent 22ccf13b33
commit 2b379968e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 213 additions and 191 deletions

View file

@ -634,15 +634,13 @@ class CmdLineTest(unittest.TestCase):
PYTHONDONTWRITEBYTECODE=value,
PYTHONVERBOSE=value,
)
dont_write_bytecode = int(bool(value))
expected_bool = int(bool(value))
code = (
"import sys; "
"sys.stderr.write(str(sys.flags)); "
f"""sys.exit(not (
sys.flags.debug == sys.flags.optimize ==
sys.flags.verbose ==
{expected}
and sys.flags.dont_write_bytecode == {dont_write_bytecode}
sys.flags.optimize == sys.flags.verbose == {expected}
and sys.flags.debug == sys.flags.dont_write_bytecode == {expected_bool}
))"""
)
with self.subTest(envar_value=value):