@@ -49,3 +49,55 @@ def f(x, cb):
49
49
L0:
50
50
r0 = PyWeakref_NewRef(x, cb)
51
51
return r0
52
+
53
+ [case testWeakrefProxy]
54
+ import weakref
55
+ from typing import Any, Callable
56
+ def f(x: object) -> object:
57
+ return weakref.proxy(x)
58
+
59
+ [out]
60
+ def f(x):
61
+ x, r0 :: object
62
+ L0:
63
+ r0 = PyWeakref_NewProxy(x, 0)
64
+ return r0
65
+
66
+ [case testWeakrefProxyCallback]
67
+ import weakref
68
+ from typing import Any, Callable
69
+ def f(x: object, cb: Callable[[object], Any]) -> object:
70
+ return weakref.proxy(x, cb)
71
+
72
+ [out]
73
+ def f(x, cb):
74
+ x, cb, r0 :: object
75
+ L0:
76
+ r0 = PyWeakref_NewProxy(x, cb)
77
+ return r0
78
+
79
+ [case testFromWeakrefProxy]
80
+ from typing import Any, Callable
81
+ from weakref import proxy
82
+ def f(x: object) -> object:
83
+ return proxy(x)
84
+
85
+ [out]
86
+ def f(x):
87
+ x, r0 :: object
88
+ L0:
89
+ r0 = PyWeakref_NewProxy(x, 0)
90
+ return r0
91
+
92
+ [case testFromWeakrefProxyCallback]
93
+ from typing import Any, Callable
94
+ from weakref import proxy
95
+ def f(x: object, cb: Callable[[object], Any]) -> object:
96
+ return proxy(x, cb)
97
+
98
+ [out]
99
+ def f(x, cb):
100
+ x, cb, r0 :: object
101
+ L0:
102
+ r0 = PyWeakref_NewProxy(x, cb)
103
+ return r0
0 commit comments