From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 11 Mar 2025 14:14:28 +0000 (+0100) Subject: [3.13] gh-130957: Use `sleeping_retry` in `test_free_reference` (GH-130958) (#131091) X-Git-Tag: v3.13.3~139 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=98c7ae3f7e6fa47cfeee388fb0992a77d6ba163a;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-130957: Use `sleeping_retry` in `test_free_reference` (GH-130958) (#131091) The weak reference may not be immediately dead. (cherry picked from commit 19081158713526a3042c2ad3c6d5a589579b420f) Co-authored-by: Sam Gross --- diff --git a/Lib/test/test_concurrent_futures/executor.py b/Lib/test/test_concurrent_futures/executor.py index 3049bb748614..3d1372a6428e 100644 --- a/Lib/test/test_concurrent_futures/executor.py +++ b/Lib/test/test_concurrent_futures/executor.py @@ -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