Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ast warnings for Python3.12 #15558

Merged
merged 9 commits into from
Jul 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions mypy/fastparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1873,15 +1873,14 @@ def visit_BinOp(self, n: ast3.BinOp) -> Type:
uses_pep604_syntax=True,
)

# Only for 3.8 and newer
def visit_Constant(self, n: Constant) -> Type:
val = n.value
if val is None:
# None is a type.
return UnboundType("None", line=self.line)
if isinstance(val, str):
# Parse forward reference.
return parse_type_string(n.s, "builtins.str", self.line, n.col_offset)
return parse_type_string(val, "builtins.str", self.line, n.col_offset)
if val is Ellipsis:
# '...' is valid in some types.
return EllipsisType(line=self.line)
Expand Down
Loading