Repository navigation
Use AST_SERIALIZE_CACHE_VERSION when natively parsing type strings - #22474
Open
Jahongir-Qurbonov wants to merge 1 commit into
Open
Jahongir-Qurbonov wants to merge 1 commit into
Jahongir-Qurbonov wants to merge 1 commit into
Conversation
native_parse_type_string() still passed a hardcoded cache_version=5 to ast_serialize.parse_type_string(), while the other parse calls use AST_SERIALIZE_CACHE_VERSION (now 7). The output for type strings is the same today, but the next version bump would silently miss this call.
Contributor
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
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.
#22434 made the native parser pass
AST_SERIALIZE_CACHE_VERSIONtoast_serialize, butnative_parse_type_string()still passes a hardcodedcache_version=5toast_serialize.parse_type_string()(the constant is now 7).The serialized output for type strings happens to be the same for versions 5 and 7 today, so nothing is broken yet, but the next version bump that changes the type encoding would be missed by this call and
read_type()would then read data written in an older format. This uses the constant here as well.