-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Expand file tree
/
Copy pathweakref_ops.py
More file actions
40 lines (35 loc) · 1.13 KB
/
weakref_ops.py
File metadata and controls
40 lines (35 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from mypyc.ir.ops import ERR_MAGIC
from mypyc.ir.rtypes import object_rprimitive, pointer_rprimitive
from mypyc.primitives.registry import function_op
# Weakref operations
new_ref_op = function_op(
name="weakref.ReferenceType",
arg_types=[object_rprimitive],
return_type=object_rprimitive,
c_function_name="PyWeakref_NewRef",
extra_int_constants=[(0, pointer_rprimitive)],
error_kind=ERR_MAGIC,
)
new_ref__with_callback_op = function_op(
name="weakref.ReferenceType",
arg_types=[object_rprimitive, object_rprimitive],
return_type=object_rprimitive,
c_function_name="PyWeakref_NewRef",
error_kind=ERR_MAGIC,
)
new_proxy_op = function_op(
name="_weakref.proxy",
arg_types=[object_rprimitive],
return_type=object_rprimitive,
c_function_name="PyWeakref_NewProxy",
extra_int_constants=[(0, pointer_rprimitive)],
error_kind=ERR_MAGIC,
)
new_proxy_with_callback_op = function_op(
name="_weakref.proxy",
arg_types=[object_rprimitive, object_rprimitive],
# steals=[True, False],
return_type=object_rprimitive,
c_function_name="PyWeakref_NewProxy",
error_kind=ERR_MAGIC,
)