This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: set union method ignores arguments appearing after the original set
Type: Stage:
Components: Versions: Python 3.1, Python 3.2, Python 2.7, Python 2.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: rhettinger, ssmout
Priority: high Keywords: patch

Created on 2009-07-25 15:24 by ssmout, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
set_union.patch ssmout, 2009-07-25 15:24 fix
Messages (3)
msg90925 - (view) Author: Shawn Smout (ssmout) Date: 2009-07-25 15:24
When calling the union method of a set with several arguments, if one of
those sets is the original set, all arguments appearing after it are
ignored.  For example:

x = set()
x.union(set([1]), x, set([2]))

evaluates to set([1]), not set([1, 2]) as expected.  As another example,
since all empty frozensets are the same,

frozenset().union(frozenset([1]), frozenset(), frozenset([2]))

also evaluates to just frozenset([1]).

The fix is trivial, so I'm attaching a patch.
msg90987 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2009-07-27 17:41
Good catch.  Thanks.
msg90997 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2009-07-27 20:33
Fixed.  See r74226, r74227, r74228 and r74229.
Date User Action Args
2022-04-11 14:56:51adminsetgithub: 50822
2009-07-27 20:33:44rhettingersetstatus: open -> closed
resolution: fixed
messages: + msg90997

versions: + Python 2.6, Python 3.1, Python 2.7, Python 3.2
2009-07-27 17:41:58rhettingersetpriority: high

messages: + msg90987
2009-07-25 15:26:03benjamin.petersonsetassignee: rhettinger

nosy: + rhettinger
2009-07-25 15:24:20ssmoutcreate