mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Issue #20006: Fix sporadic failures in test_weakset.
This commit is contained in:
parent
0c73fc04e6
commit
320b39158e
2 changed files with 8 additions and 1 deletions
|
|
@ -370,9 +370,14 @@ class TestWeakSet(unittest.TestCase):
|
|||
def testcontext():
|
||||
try:
|
||||
it = iter(s)
|
||||
next(it)
|
||||
# Start iterator
|
||||
yielded = ustr(str(next(it)))
|
||||
# Schedule an item for removal and recreate it
|
||||
u = ustr(str(items.pop()))
|
||||
if yielded == u:
|
||||
# The iterator still has a reference to the removed item,
|
||||
# advance it (issue #20006).
|
||||
next(it)
|
||||
gc.collect() # just in case
|
||||
yield u
|
||||
finally:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue