Repository navigation
Conversation
Add MS_TYPE_BOOLLITERAL_TRUE/FALSE flags and handle PyBool_Type before PyLong_Type in typenode_collect_literal. Update decode paths (JSON, msgpack, convert) to validate against specific bool literal values. Closes #859
Contributor
Author
|
CI failures are unrelated to this change: "Profile Windows (ARM64)" - runner infra issue ("Install command runner" step) |
Contributor
Author
|
Resolved in the community fork msgspec-arise: PR #12, released in v0.20.2. |
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.
Summary
Literal[True],Literal[False], andLiteral[True, False]in type definitionsMS_TYPE_BOOLLITERAL_TRUE/MS_TYPE_BOOLLITERAL_FALSEflags to distinguish bool literals from plainboolPyBool_TypebeforePyLong_Typeintypenode_collect_literal(sinceboolis a subclass ofint)inspect.pyLiteralType.valuestype annotation to includeboolCloses #859
Test plan
Ubuntu 22.04 (WSL2, x86_64, gcc 11.4, Python 3.10):
Ubuntu 24.04 (WSL2, x86_64, gcc 13.3, Python 3.12):
New parametrized tests cover:
Literal[True]- accepts True, rejects FalseLiteral[False]- accepts False, rejects TrueLiteral[True, False]- accepts bothLiteral[1, False]- mixed int + bool literalLiteral[True, "yes", None]- mixed bool + str + None literalUnion[Literal[True], bool]- bool literal combined with plain boolCI passes on all platforms