Skip to content

Commit

Permalink
pythongh-130957: Use sleeping_retry in test_free_reference
Browse files Browse the repository at this point in the history
The weak reference may not be immediately dead.
  • Loading branch information
colesbury committed Mar 7, 2025
1 parent 12db452 commit bc3ff28
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Lib/test/test_concurrent_futures/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,7 @@ def test_free_reference(self):
wr = weakref.ref(obj)
del obj
support.gc_collect() # For PyPy or other GCs.
self.assertIsNone(wr())

for _ in support.sleeping_retry(support.SHORT_TIMEOUT):
if wr() is None:
break

0 comments on commit bc3ff28

Please sign in to comment.