Skip to content

Commit a759c49

Browse files
Fix ast warnings for Python3.12 (#15558)
Warnings before: #15330 (comment) Warnings after: ``` (.venv312) ~/Desktop/mypy master ✗ » python -m mypy ex.py Success: no issues found in 1 source file ``` Zero :) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 259c822 commit a759c49

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mypy/fastparse.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1873,15 +1873,14 @@ def visit_BinOp(self, n: ast3.BinOp) -> Type:
18731873
uses_pep604_syntax=True,
18741874
)
18751875

1876-
# Only for 3.8 and newer
18771876
def visit_Constant(self, n: Constant) -> Type:
18781877
val = n.value
18791878
if val is None:
18801879
# None is a type.
18811880
return UnboundType("None", line=self.line)
18821881
if isinstance(val, str):
18831882
# Parse forward reference.
1884-
return parse_type_string(n.s, "builtins.str", self.line, n.col_offset)
1883+
return parse_type_string(val, "builtins.str", self.line, n.col_offset)
18851884
if val is Ellipsis:
18861885
# '...' is valid in some types.
18871886
return EllipsisType(line=self.line)

0 commit comments

Comments
 (0)