Skip to content

Commit fe27d2c

Browse files
Update specialize.py
1 parent 6e8b738 commit fe27d2c

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

mypyc/irbuild/specialize.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,7 @@ def apply_function_specialization(
142142
builder: IRBuilder, expr: CallExpr, callee: RefExpr
143143
) -> Value | None:
144144
"""Invoke the Specializer callback for a function if one has been registered"""
145-
if (
146-
isinstance(callee, NameExpr)
147-
# and isinstance(callee.node, Var)
148-
# NOTE: why is this not a weakref rprimitive?
149-
# TODO: fix to weakref rprimitive so _apply_specialization can use the custom_op
150-
and is_weakref_rprimitive(builder.node_type(callee))
151-
# and str(callee.node.type).startswith("weakref.ReferenceType")
152-
and len(expr.args) == 0
153-
):
145+
if is_weakref_rprimitive(builder.node_type(callee)) and len(expr.args) == 0:
154146
return builder.call_c(weakref_deref_op, [builder.accept(expr.callee)], expr.line)
155147
return _apply_specialization(builder, expr, callee, callee.fullname)
156148

0 commit comments

Comments
 (0)