File tree Expand file tree Collapse file tree 2 files changed +0
-33
lines changed Expand file tree Collapse file tree 2 files changed +0
-33
lines changed Original file line number Diff line number Diff line change 1
- [case testWeakrefRef]
2
- import weakref
3
- from typing import Any, Callable
4
- def f(x: object) -> object:
5
- return weakref.ref(x)
6
-
7
- [out]
8
- def f(x):
9
- x, r0 :: object
10
- L0:
11
- r0 = PyWeakref_NewRef(x, NULL)
12
- return r0
13
-
14
1
[case testWeakrefRefCallback]
15
2
import weakref
16
3
from typing import Any, Callable
24
11
r0 = PyWeakref_NewRef(x, cb)
25
12
return r0
26
13
27
- [case testFromWeakrefRef]
28
- from typing import Any, Callable
29
- from weakref import ref
30
- def f(x: object) -> object:
31
- return ref(x)
32
-
33
- [out]
34
- def f(x):
35
- x, r0 :: object
36
- L0:
37
- r0 = PyWeakref_NewRef(x, NULL)
38
- return r0
39
-
40
14
[case testFromWeakrefRefCallback]
41
15
from typing import Any, Callable
42
16
from weakref import ref
Original file line number Diff line number Diff line change @@ -10,13 +10,6 @@ class Object:
10
10
"""some random weakreffable object"""
11
11
pass
12
12
13
- def test_weakref_ref():
14
- obj = Object()
15
- r = ref(obj)
16
- assert r() is obj
17
- obj = None
18
- assert r() is None, r()
19
-
20
13
def test_weakref_ref_with_callback():
21
14
obj = Object()
22
15
r = ref(obj, lambda x: x)
You can’t perform that action at this time.
0 commit comments