From c6583076894b9e9a3b8a96bdfd32907379b46f39 Mon Sep 17 00:00:00 2001 From: Jahongir Qurbonov Date: Sat, 14 Nov 2026 15:54:58 +0500 Subject: [PATCH] Use AST_SERIALIZE_CACHE_VERSION when natively parsing type strings 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. --- mypy/nativeparse.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mypy/nativeparse.py b/mypy/nativeparse.py index a613e5a45c7c..6cd181b0788d 100644 --- a/mypy/nativeparse.py +++ b/mypy/nativeparse.py @@ -367,7 +367,9 @@ def native_parse_type_string( If parsing fails, a RawExpressionType will be returned. """ ast_bytes = ast_serialize.parse_type_string( - expr_string, (line, column, end_line, end_column), cache_version=5 + expr_string, + (line, column, end_line, end_column), + cache_version=AST_SERIALIZE_CACHE_VERSION, ) state = State(options) data = ReadBuffer(ast_bytes)