https://github.com/python/cpython/commit/afffd97cd9066d6c7864d932cf7e9de1b7bb5051
commit: afffd97cd9066d6c7864d932cf7e9de1b7bb5051
branch: 3.12
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: colesbury <colesb...@gmail.com>
date: 2025-03-11T10:13:41-04:00
summary:

[3.12] gh-130957: Use `sleeping_retry` in `test_free_reference` (GH-130958) 
(#131092)

The weak reference may not be immediately dead.
(cherry picked from commit 19081158713526a3042c2ad3c6d5a589579b420f)

Co-authored-by: Sam Gross <colesb...@gmail.com>

files:
M Lib/test/test_concurrent_futures/executor.py

diff --git a/Lib/test/test_concurrent_futures/executor.py 
b/Lib/test/test_concurrent_futures/executor.py
index 1e7d4344740943..b3574c7c58af42 100644
--- a/Lib/test/test_concurrent_futures/executor.py
+++ b/Lib/test/test_concurrent_futures/executor.py
@@ -105,4 +105,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

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to