From 0e5284f05c1b5a041037d41c5ce2d01ffcef0ceb Mon Sep 17 00:00:00 2001 From: STerliakov Date: Tue, 4 Nov 2025 14:03:42 +0100 Subject: [PATCH] Reuse NOT_IMPLEMENTED_TYPE_NAMES --- mypy/checker.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mypy/checker.py b/mypy/checker.py index f3a93d1eeda1..9f8299e6805d 100644 --- a/mypy/checker.py +++ b/mypy/checker.py @@ -5134,13 +5134,10 @@ def type_check_raise(self, e: Expression, s: RaiseStmt, optional: bool = False) # https://github.com/python/mypy/issues/11089 self.expr_checker.check_call(typ, [], [], e) - if ( - isinstance(typ, Instance) - and typ.type.fullname in {"builtins._NotImplementedType", "types.NotImplementedType"} - ) or ( + if (isinstance(typ, Instance) and typ.type.fullname in NOT_IMPLEMENTED_TYPE_NAMES) or ( isinstance(e, CallExpr) and isinstance(e.callee, RefExpr) - and e.callee.fullname in {"builtins.NotImplemented"} + and e.callee.fullname == "builtins.NotImplemented" ): self.fail( message_registry.INVALID_EXCEPTION.with_additional_msg(