Skip to content

Commit 2fd137e

Browse files
committed
Call subclasses() instead of all_concrete_classes()
1 parent 54dc884 commit 2fd137e

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

mypyc/irbuild/specialize.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
Var,
3535
)
3636
from mypy.types import AnyType, TypeOfAny
37-
from mypyc.ir.class_ir import all_concrete_classes
3837
from mypyc.ir.ops import (
3938
BasicBlock,
4039
Call,
@@ -1104,8 +1103,8 @@ def translate_object_new(builder: IRBuilder, expr: CallExpr, callee: RefExpr) ->
11041103
method_args = fn.fitem.arg_names
11051104
if isinstance(typ_arg, NameExpr) and len(method_args) > 0 and method_args[0] == typ_arg.name:
11061105
subtype = builder.accept(expr.args[0])
1107-
classes = all_concrete_classes(ir)
1108-
if classes and len(classes) == 1:
1106+
subs = ir.subclasses()
1107+
if subs is not None and len(subs) == 0:
11091108
return builder.add(Call(ir.setup, [subtype], expr.line))
11101109
# Call a function that dynamically resolves the setup function of extension classes from the type object.
11111110
# This is necessary because the setup involves default attribute initialization and setting up

0 commit comments

Comments
 (0)