Skip to content

Commit 0f8c2f7

Browse files
committed
Merge branch 'weakref-call' of https://github.com/BobTheBuidler/mypy into weakref-call
2 parents 7c2d36b + 82483eb commit 0f8c2f7

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

mypyc/irbuild/specialize.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
RefExpr,
3232
StrExpr,
3333
TupleExpr,
34-
Var,
3534
)
3635
from mypy.types import AnyType, TypeOfAny
3736
from mypyc.ir.ops import (
@@ -145,10 +144,11 @@ def apply_function_specialization(
145144
"""Invoke the Specializer callback for a function if one has been registered"""
146145
if (
147146
isinstance(callee, NameExpr)
148-
and isinstance(callee.node, Var)
147+
# and isinstance(callee.node, Var)
149148
# NOTE: why is this not a weakref rprimitive?
150149
# TODO: fix to weakref rprimitive so _apply_specialization can use the custom_op
151-
and str(callee.node.type).startswith("weakref.ReferenceType")
150+
and is_weakref_rprimitive(builder.node_type(callee.node))
151+
# and str(callee.node.type).startswith("weakref.ReferenceType")
152152
and len(expr.args) == 0
153153
):
154154
return builder.call_c(weakref_deref_op, [builder.accept(expr.callee)], expr.line)

mypyc/test-data/irbuild-weakref.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,3 @@ L0:
6969
r = r0
7070
r1 = CPyWeakref_GetRef(r)
7171
return r1
72-

0 commit comments

Comments
 (0)