-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-107954: Add PyConfig_MEMBER_BOOL type to PyConfigSpec #116359
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
_PyConfig_AsDict() now returns bool objects for options using the new PyConfig_MEMBER_BOOL type. Update tests for these changes.
cc @swtaarrs |
Lib/test/test_embed.py
Outdated
'code_debug_ranges': 1, | ||
'show_ref_count': 0, | ||
'dump_refs': 0, | ||
'cpu_count': -True, |
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.
cpu_count
is still an int, so I think this change is 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.
Oops, fixed. I blindly replaced 0 with False and 1 with True :-)
if (spec->type == PyConfig_MEMBER_BOOL | ||
|| spec->type == PyConfig_MEMBER_UINT) | ||
{ | ||
if (value < 0) { | ||
config_dict_invalid_value(spec->name); | ||
return -1; | ||
} | ||
} |
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.
Would it be worth also verifying that value <= 1
for BOOL
?
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.
Currently, PyConfig_Read() doesn't normalize boolean values to (0, 1). I prefer to tolerate values larger than 1 for now.
The main reason for this change is to return bool in _PyConfig_AsDict().
…n#116359) _PyConfig_AsDict() now returns bool objects for options using the new PyConfig_MEMBER_BOOL type. Update tests for these changes.
…n#116359) _PyConfig_AsDict() now returns bool objects for options using the new PyConfig_MEMBER_BOOL type. Update tests for these changes.
_PyConfig_AsDict() now returns bool objects for options using the new PyConfig_MEMBER_BOOL type.
Update tests for these changes.