Delete the iterator, which could accidentally keep a temporary reference to the yielded element.

This commit is contained in:
Antoine Pitrou 2012-02-21 00:00:06 +01:00
parent 9edceb3e59
commit 95a97b7c0c
1 changed files with 1 additions and 0 deletions

View File

@ -335,6 +335,7 @@ class TestWeakSet(unittest.TestCase):
try:
it = iter(s)
next(it)
del it
# Schedule an item for removal and recreate it
u = ustr(str(items.pop()))
gc.collect() # just in case