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
e805ecc7
Commit
e805ecc7
authored
Jul 27, 2009
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue 6573: Fix set.union() for cases where self is in the argument chain.
parent
e7ac4f77
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
1 deletion
+8
-1
Lib/test/test_set.py
Lib/test/test_set.py
+4
-0
Misc/NEWS
Misc/NEWS
+3
-0
Objects/setobject.c
Objects/setobject.c
+1
-1
No files found.
Lib/test/test_set.py
View file @
e805ecc7
...
@@ -82,6 +82,10 @@ class TestJointOps(unittest.TestCase):
...
@@ -82,6 +82,10 @@ class TestJointOps(unittest.TestCase):
self
.
assertEqual
(
self
.
thetype
(
'abcba'
).
union
(
C
(
'ef'
)),
set
(
'abcef'
))
self
.
assertEqual
(
self
.
thetype
(
'abcba'
).
union
(
C
(
'ef'
)),
set
(
'abcef'
))
self
.
assertEqual
(
self
.
thetype
(
'abcba'
).
union
(
C
(
'ef'
),
C
(
'fg'
)),
set
(
'abcefg'
))
self
.
assertEqual
(
self
.
thetype
(
'abcba'
).
union
(
C
(
'ef'
),
C
(
'fg'
)),
set
(
'abcefg'
))
# Issue #6573
x
=
self
.
thetype
()
self
.
assertEqual
(
x
.
union
(
set
([
1
]),
x
,
set
([
2
])),
self
.
thetype
([
1
,
2
]))
def
test_or
(
self
):
def
test_or
(
self
):
i
=
self
.
s
.
union
(
self
.
otherword
)
i
=
self
.
s
.
union
(
self
.
otherword
)
self
.
assertEqual
(
self
.
s
|
set
(
self
.
otherword
),
i
)
self
.
assertEqual
(
self
.
s
|
set
(
self
.
otherword
),
i
)
...
...
Misc/NEWS
View file @
e805ecc7
...
@@ -14,6 +14,9 @@ Core and Builtins
...
@@ -14,6 +14,9 @@ Core and Builtins
- Issue #6540: Fixed crash for bytearray.translate() with invalid parameters.
- Issue #6540: Fixed crash for bytearray.translate() with invalid parameters.
- Issue #6573: set.union() stopped processing inputs if an instance of self
occurred in the argument chain.
- Issue #6070: On posix platforms import no longer copies the execute bit
- Issue #6070: On posix platforms import no longer copies the execute bit
from the .py file to the .pyc file if it is set.
from the .py file to the .pyc file if it is set.
...
...
Objects/setobject.c
View file @
e805ecc7
...
@@ -1187,7 +1187,7 @@ set_union(PySetObject *so, PyObject *args)
...
@@ -1187,7 +1187,7 @@ set_union(PySetObject *so, PyObject *args)
for
(
i
=
0
;
i
<
PyTuple_GET_SIZE
(
args
)
;
i
++
)
{
for
(
i
=
0
;
i
<
PyTuple_GET_SIZE
(
args
)
;
i
++
)
{
other
=
PyTuple_GET_ITEM
(
args
,
i
);
other
=
PyTuple_GET_ITEM
(
args
,
i
);
if
((
PyObject
*
)
so
==
other
)
if
((
PyObject
*
)
so
==
other
)
return
(
PyObject
*
)
result
;
continue
;
if
(
set_update_internal
(
result
,
other
)
==
-
1
)
{
if
(
set_update_internal
(
result
,
other
)
==
-
1
)
{
Py_DECREF
(
result
);
Py_DECREF
(
result
);
return
NULL
;
return
NULL
;
...
...
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