]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-130957: Use `sleeping_retry` in `test_free_reference` (GH-130958) (#131091)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 11 Mar 2025 14:14:28 +0000 (15:14 +0100)
committerGitHub <noreply@github.com>
Tue, 11 Mar 2025 14:14:28 +0000 (14:14 +0000)
The weak reference may not be immediately dead.
(cherry picked from commit 19081158713526a3042c2ad3c6d5a589579b420f)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Lib/test/test_concurrent_futures/executor.py

index 3049bb74861439dc909f470c5c4a50e6dd308113..3d1372a6428ec0e05d659ba3614ecc317f44e758 100644 (file)
@@ -128,4 +128,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