Author: Carl Friedrich Bolz-Tereick <[email protected]>
Branch: py3.7
Changeset: r98583:aa34f98b135c
Date: 2020-01-25 15:59 +0100
http://bitbucket.org/pypy/pypy/changeset/aa34f98b135c/

Log:    fix a bug in SimpleWeakSet: The weakref from the data set can
        already be dead.

        This can happen because (in PyPy at least) a weakref can be dead
        without its callback having been called yet. The bug caused very
        obscure test_collections.py failures.

        Unfortunately I completely failed to write a small test for the
        problem :-(.

diff --git a/pypy/module/_abc/app_abc.py b/pypy/module/_abc/app_abc.py
--- a/pypy/module/_abc/app_abc.py
+++ b/pypy/module/_abc/app_abc.py
@@ -24,7 +24,8 @@
         copy = list(self.data)
         for itemref in copy:
             item = itemref()
-            yield item
+            if item is not None:
+                yield item
 
     def __contains__(self, item):
         try:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to