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
1cf48b4a
Commit
1cf48b4a
authored
May 22, 2013
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement missing inequality on WeakSet
parent
54f70923
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
+14
-0
Lib/_weakrefset.py
Lib/_weakrefset.py
+6
-0
Lib/test/test_weakset.py
Lib/test/test_weakset.py
+6
-0
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/_weakrefset.py
View file @
1cf48b4a
...
...
@@ -171,6 +171,12 @@ class WeakSet(object):
return
NotImplemented
return
self
.
data
==
set
(
ref
(
item
)
for
item
in
other
)
def
__ne__
(
self
,
other
):
opposite
=
self
.
__eq__
(
other
)
if
opposite
is
NotImplemented
:
return
NotImplemented
return
not
opposite
def
symmetric_difference
(
self
,
other
):
newset
=
self
.
copy
()
newset
.
symmetric_difference_update
(
other
)
...
...
Lib/test/test_weakset.py
View file @
1cf48b4a
...
...
@@ -351,6 +351,12 @@ class TestWeakSet(unittest.TestCase):
self
.
assertFalse
(
self
.
s
==
tuple
(
self
.
items
))
self
.
assertFalse
(
self
.
s
==
1
)
def
test_ne
(
self
):
self
.
assertTrue
(
self
.
s
!=
set
(
self
.
items
))
s1
=
WeakSet
()
s2
=
WeakSet
()
self
.
assertFalse
(
s1
!=
s2
)
def
test_weak_destroy_while_iterating
(
self
):
# Issue #7105: iterators shouldn't crash when a key is implicitly removed
# Create new items to be sure no-one else holds a reference
...
...
Misc/NEWS
View file @
1cf48b4a
...
...
@@ -15,6 +15,8 @@ Core and Builtins
Library
-------
- Implement inequality on weakref.WeakSet.
- Issue #17981: Closed socket on error in SysLogHandler.
- Issue #17754: Make ctypes.util.find_library() independent of the locale.
...
...
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