Skip to content

Commit 08dde9f

Browse files
authored
refactor: reuse NOT_IMPLEMENTED_TYPE_NAMES (#20178)
1 parent 3c30736 commit 08dde9f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

mypy/checker.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5134,13 +5134,10 @@ def type_check_raise(self, e: Expression, s: RaiseStmt, optional: bool = False)
51345134
# https://github.com/python/mypy/issues/11089
51355135
self.expr_checker.check_call(typ, [], [], e)
51365136

5137-
if (
5138-
isinstance(typ, Instance)
5139-
and typ.type.fullname in {"builtins._NotImplementedType", "types.NotImplementedType"}
5140-
) or (
5137+
if (isinstance(typ, Instance) and typ.type.fullname in NOT_IMPLEMENTED_TYPE_NAMES) or (
51415138
isinstance(e, CallExpr)
51425139
and isinstance(e.callee, RefExpr)
5143-
and e.callee.fullname in {"builtins.NotImplemented"}
5140+
and e.callee.fullname == "builtins.NotImplemented"
51445141
):
51455142
self.fail(
51465143
message_registry.INVALID_EXCEPTION.with_additional_msg(

0 commit comments

Comments
 (0)