Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
320b3915
Commit
320b3915
authored
Dec 18, 2013
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #20006: Fix sporadic failures in test_weakset.
parent
0c73fc04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
Lib/_weakrefset.py
Lib/_weakrefset.py
+2
-0
Lib/test/test_weakset.py
Lib/test/test_weakset.py
+6
-1
No files found.
Lib/_weakrefset.py
View file @
320b3915
...
...
@@ -60,6 +60,8 @@ class WeakSet:
for
itemref
in
self
.
data
:
item
=
itemref
()
if
item
is
not
None
:
# Caveat: the iterator will keep a strong reference to
# `item` until it is resumed or closed.
yield
item
def
__len__
(
self
):
...
...
Lib/test/test_weakset.py
View file @
320b3915
...
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment