gh-107954: Add PyConfig_MEMBER_BOOL type to PyConfigSpec#116359
Merged
vstinner merged 5 commits intopython:mainfrom Mar 6, 2024
Merged
gh-107954: Add PyConfig_MEMBER_BOOL type to PyConfigSpec#116359vstinner merged 5 commits intopython:mainfrom
vstinner merged 5 commits intopython:mainfrom
Conversation
_PyConfig_AsDict() now returns bool objects for options using the new PyConfig_MEMBER_BOOL type. Update tests for these changes.
Member
Author
|
cc @swtaarrs |
swtaarrs
reviewed
Mar 5, 2024
Lib/test/test_embed.py
Outdated
| 'code_debug_ranges': 1, | ||
| 'show_ref_count': 0, | ||
| 'dump_refs': 0, | ||
| 'cpu_count': -True, |
Member
There was a problem hiding this comment.
cpu_count is still an int, so I think this change is wrong.
Member
Author
There was a problem hiding this comment.
Oops, fixed. I blindly replaced 0 with False and 1 with True :-)
Comment on lines
+1304
to
1311
| if (spec->type == PyConfig_MEMBER_BOOL | ||
| || spec->type == PyConfig_MEMBER_UINT) | ||
| { | ||
| if (value < 0) { | ||
| config_dict_invalid_value(spec->name); | ||
| return -1; | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Would it be worth also verifying that value <= 1 for BOOL?
Member
Author
There was a problem hiding this comment.
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().
adorilson
pushed a commit
to adorilson/cpython
that referenced
this pull request
Mar 25, 2024
…n#116359) _PyConfig_AsDict() now returns bool objects for options using the new PyConfig_MEMBER_BOOL type. Update tests for these changes.
diegorusso
pushed a commit
to diegorusso/cpython
that referenced
this pull request
Apr 17, 2024
…n#116359) _PyConfig_AsDict() now returns bool objects for options using the new PyConfig_MEMBER_BOOL type. Update tests for these changes.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
_PyConfig_AsDict() now returns bool objects for options using the new PyConfig_MEMBER_BOOL type.
Update tests for these changes.