Skip to content

Commit 9b584b6

Browse files
committed
modify typeshed instead of hacking calculate_mro
1 parent fb04bad commit 9b584b6

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

mypy/mro.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ def calculate_mro(info: TypeInfo, obj_type: Callable[[], Instance] | None = None
1515
mro = linearize_hierarchy(info, obj_type)
1616
assert mro, f"Could not produce a MRO at all for {info}"
1717
info.mro = mro
18-
# The property of falling back to Any is (usually) inherited.
19-
if info.fullname == "builtins._NotImplementedType":
20-
info.fallback_to_any = False
21-
else:
22-
info.fallback_to_any = any(baseinfo.fallback_to_any for baseinfo in info.mro)
18+
# The property of falling back to Any is inherited.
19+
info.fallback_to_any = any(baseinfo.fallback_to_any for baseinfo in info.mro)
2320

2421
type_state.reset_all_subtype_caches_for(info)
2522

mypy/typeshed/stdlib/builtins.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,7 @@ class property:
12691269

12701270
@final
12711271
@type_check_only
1272-
class _NotImplementedType(Any):
1272+
class _NotImplementedType:
12731273
__call__: None
12741274

12751275
NotImplemented: _NotImplementedType

test-data/unit/fixtures/notimplemented.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class tuple: pass
1313
class dict: pass
1414
class classmethod: pass
1515

16-
class _NotImplementedType(Any):
16+
class _NotImplementedType:
1717
__call__: NotImplemented # type: ignore
1818
NotImplemented: _NotImplementedType
1919

0 commit comments

Comments
 (0)