[Python-checkins] r74229 - in python/branches/release26-maint: Lib/test/test_set.py Misc/NEWS Objects/setobject.c
raymond.hettinger
python-checkins at python.org
Mon Jul 27 22:33:25 CEST 2009
Author: raymond.hettinger
Date: Mon Jul 27 22:33:25 2009
New Revision: 74229
Log:
Issue 6573: Fix set.union() for cases where self is in the argument chain.
Modified:
python/branches/release26-maint/Lib/test/test_set.py
python/branches/release26-maint/Misc/NEWS
python/branches/release26-maint/Objects/setobject.c
Modified: python/branches/release26-maint/Lib/test/test_set.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_set.py (original)
+++ python/branches/release26-maint/Lib/test/test_set.py Mon Jul 27 22:33:25 2009
@@ -81,6 +81,10 @@
self.assertEqual(self.thetype('abcba').union(C('ef')), set('abcef'))
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):
i = self.s.union(self.otherword)
self.assertEqual(self.s | set(self.otherword), i)
Modified: python/branches/release26-maint/Misc/NEWS
==============================================================================
--- python/branches/release26-maint/Misc/NEWS (original)
+++ python/branches/release26-maint/Misc/NEWS Mon Jul 27 22:33:25 2009
@@ -14,6 +14,9 @@
- 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
from the .py file to the .pyc file if it is set.
Modified: python/branches/release26-maint/Objects/setobject.c
==============================================================================
--- python/branches/release26-maint/Objects/setobject.c (original)
+++ python/branches/release26-maint/Objects/setobject.c Mon Jul 27 22:33:25 2009
@@ -1183,7 +1183,7 @@
for (i=0 ; i<PyTuple_GET_SIZE(args) ; i++) {
other = PyTuple_GET_ITEM(args, i);
if ((PyObject *)so == other)
- return (PyObject *)result;
+ continue;
if (set_update_internal(result, other) == -1) {
Py_DECREF(result);
return NULL;
More information about the Python-checkins
mailing list