From 63853bbdc4d116386d617542a7d2da2233352bca Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Mon, 27 Jul 2009 20:29:18 +0000 Subject: [PATCH] Issue 6573: Fix set.union() for cases where self is in the argument chain. --- Lib/test/test_set.py | 4 ++++ Misc/NEWS | 3 +++ Objects/setobject.c | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py index 15d3c6f97d8..222726cb1a5 100644 --- a/Lib/test/test_set.py +++ b/Lib/test/test_set.py @@ -82,6 +82,10 @@ def test_union(self): 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) diff --git a/Misc/NEWS b/Misc/NEWS index cca4d76f350..a882c9cc660 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -14,6 +14,9 @@ Core and Builtins - 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. diff --git a/Objects/setobject.c b/Objects/setobject.c index 8ecc405bc5f..b296f9f3297 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -1187,7 +1187,7 @@ set_union(PySetObject *so, PyObject *args) for (i=0 ; i