We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 427f31c commit 089e952Copy full SHA for 089e952
1 file changed
mypy/subtypes.py
@@ -538,11 +538,12 @@ def visit_instance(self, left: Instance) -> bool:
538
lname = left.type.fullname
539
540
# Check if this is an unsafe subtype relationship that should be blocked
541
- if self.options and codes.UNSAFE_SUBTYPE in self.options.enabled_error_codes:
542
- # Block unsafe subtyping relationships when the error code is enabled
543
- for subclass, superclass in UNSAFE_SUBTYPING_PAIRS:
544
- if lname == subclass and rname == superclass:
545
- return False
+ if (
+ self.options
+ and codes.UNSAFE_SUBTYPE in self.options.enabled_error_codes
+ and (lname, rname) in UNSAFE_SUBTYPING_PAIRS
+ ):
546
+ return False
547
548
# Always try a nominal check if possible,
549
# there might be errors that a user wants to silence *once*.
0 commit comments