]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-130957: Use `sleeping_retry` in `test_free_reference` (#130958)
authorSam Gross <colesbury@gmail.com>
Tue, 11 Mar 2025 13:51:26 +0000 (09:51 -0400)
committerGitHub <noreply@github.com>
Tue, 11 Mar 2025 13:51:26 +0000 (09:51 -0400)
The weak reference may not be immediately dead.

Lib/test/test_concurrent_futures/executor.py

index b97d9ffd94b1f8829978018e1c022fb779d8558c..dc92d2d7e4af92cb2c75ff4bbe81b0d97692e77e 100644 (file)
@@ -129,4 +129,7 @@ class ExecutorTest:
             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