File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 11from mypyc .ir .ops import ERR_MAGIC
22from mypyc .ir .rtypes import object_rprimitive
3- from mypyc .primitives .registry import function_op
3+ from mypyc .primitives .registry import ERR_NEG_INT , function_op
44
55# Weakref operations
66
1111 c_function_name = "PyWeakref_NewRef" ,
1212 error_kind = ERR_MAGIC ,
1313)
14+
15+ deref_op = function_op (
16+ name = "weakref.ReferenceType.__call__" ,
17+ arg_types = [object_rprimitive ],
18+ return_type = object_rprimitive ,
19+ c_function_name = "PyWeakref_GetRef" ,
20+ error_kind = ERR_NEG_INT ,
21+ )
Original file line number Diff line number Diff line change 1515from typing import Any, Callable
1616from weakref import ref
1717def f(x: object, cb: Callable[[object], Any]) -> object:
18- return ref(x, cb)
18+ return ref(x, cb)()
1919
2020[out]
2121def f(x, cb):
22- x, cb, r0 :: object
22+ x, cb, r0, r1 :: object
2323L0:
2424 r0 = PyWeakref_NewRef(x, cb)
25- return r0
25+ r1 = PyWeakref_GetRef(r0)
26+ return r1
You can’t perform that action at this time.
0 commit comments