Skip to content

Commit 37fc759

Browse files
Update run-weakref.test
1 parent 928e5a5 commit 37fc759

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mypyc/test-data/run-weakref.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ def test_weakref_proxy():
5858
p = proxy(obj)
5959
assert obj.some_meth() == 1
6060
assert p.some_meth() == 1
61+
62+
# we just need to do something with `obj` down here so mypyc keeps its reference thru the above line
63+
obj.some_meth()
64+
6165
obj = None
6266
with pytest.raises(ReferenceError):
6367
p.some_meth()
@@ -84,6 +88,10 @@ def test_weakref_proxy_with_callback():
8488
p = proxy(obj, lambda x: x)
8589
assert obj.some_meth() == 1
8690
assert p.some_meth() == 1
91+
92+
# we just need to do something with `obj` down here so mypyc keeps its reference thru the above line
93+
obj.some_meth()
94+
8795
obj = None
8896
with pytest.raises(ReferenceError):
8997
p.some_meth()

0 commit comments

Comments
 (0)