Skip to content

Commit 1ee28d8

Browse files
committed
added explicit checks for None before calling obj_type() to prevent errors if obj_type is None.
1 parent d7ebe2e commit 1ee28d8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mypy/mro.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ def linearize_hierarchy(
3232
return info.mro
3333
bases = info.direct_base_classes()
3434
if not bases and info.fullname != "builtins.object" and obj_type is not None:
35-
# Probably an error, add a dummy `object` base class,
36-
# otherwise MRO calculation may spuriously fail.
35+
# If no base classes are found, and obj_type is provided, we use obj_type to provide a base.
3736
bases = [obj_type().type]
3837
lin_bases = []
3938
for base in bases:

0 commit comments

Comments
 (0)