Skip to content

Commit

Permalink
Correctly recognize typing_extensions.NewType
Browse files Browse the repository at this point in the history
  • Loading branch information
gschaffner committed Oct 19, 2023
1 parent 1f20d68 commit 4882ccc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mypy/semanal_newtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def analyze_newtype_declaration(self, s: AssignmentStmt) -> tuple[str | None, Ca
and isinstance(s.lvalues[0], NameExpr)
and isinstance(s.rvalue, CallExpr)
and isinstance(s.rvalue.callee, RefExpr)
and s.rvalue.callee.fullname == "typing.NewType"
and (s.rvalue.callee.fullname in ("typing.NewType", "typing_extensions.NewType"))
):
name = s.lvalues[0].name

Expand Down

0 comments on commit 4882ccc

Please sign in to comment.