Skip to content

Commit bb05513

Browse files
authored
Fix exception handler target location in new parser (#21185)
1 parent c8f4074 commit bb05513

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

mypy/nativeparse.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ def parse_to_binary_ast(
280280
platform=options.platform,
281281
always_true=options.always_true,
282282
always_false=options.always_false,
283+
cache_version=1,
283284
)
284285
return (
285286
ast_bytes,
@@ -823,6 +824,7 @@ def read_try_stmt(state: State, data: ReadBuffer) -> TryStmt:
823824
if has_name:
824825
var_name = read_str(data)
825826
var_expr = NameExpr(var_name)
827+
read_loc(data, var_expr)
826828
vars_list.append(var_expr)
827829
else:
828830
vars_list.append(None)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ python2 = []
6464
reports = ["lxml"]
6565
install-types = ["pip"]
6666
faster-cache = ["orjson"]
67-
native-parser = ["ast-serialize>=0.1.1,<1.0.0"]
67+
native-parser = ["ast-serialize>=0.1.2,<1.0.0"]
6868

6969
[project.urls]
7070
Homepage = "https://www.mypy-lang.org/"

test-data/unit/check-statements.test

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -851,9 +851,7 @@ def error_in_tuple_union(exc: Tuple[Union[Type[E1], Type[E2]], Union[Type[E3], i
851851
pass
852852
[builtins fixtures/tuple.pyi]
853853

854-
[case testExceptWithMultipleTypes6_no_parallel]
855-
# For no_parallel, see:
856-
# https://github.com/mypyc/ast_serialize/issues/50
854+
[case testExceptWithMultipleTypes6]
857855
from typing import Never
858856

859857
def random() -> bool: ...

test-requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ pytest-cov>=2.10.0
1313
setuptools>=77.0.3
1414
tomli>=1.1.0 # needed even on py311+ so the self check passes with --python-version 3.10
1515
pre_commit>=3.5.0
16-
ast-serialize>=0.1.1,<1.0.0
16+
ast-serialize>=0.1.2,<1.0.0

test-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# pip-compile --allow-unsafe --output-file=test-requirements.txt --strip-extras test-requirements.in
66
#
7-
ast-serialize==0.1.1
7+
ast-serialize==0.1.2
88
# via -r test-requirements.in
99
attrs==25.4.0
1010
# via -r test-requirements.in

0 commit comments

Comments
 (0)