From: Raymond Hettinger Date: Mon, 25 Nov 2002 20:43:55 +0000 (+0000) Subject: SF 643115: Set._update() had a special case for dictionaries which allowed X-Git-Tag: v2.3c1~3243 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=35e48d2426e50306cb957da26777b1e3469c53b3;p=thirdparty%2FPython%2Fcpython.git SF 643115: Set._update() had a special case for dictionaries which allowed non-true values to leak in. This threw-off equality testing which depends on the underlying dictionaries having both the same keys and values. --- diff --git a/Lib/sets.py b/Lib/sets.py index 5dac370a6447..2605c98fd098 100644 --- a/Lib/sets.py +++ b/Lib/sets.py @@ -315,9 +315,6 @@ class BaseSet(object): if isinstance(iterable, BaseSet): data.update(iterable._data) return - if isinstance(iterable, dict): - data.update(iterable) - return value = True diff --git a/Lib/test/test_sets.py b/Lib/test/test_sets.py index 9bc3eeba7480..f80d58e82ef2 100644 --- a/Lib/test/test_sets.py +++ b/Lib/test/test_sets.py @@ -179,6 +179,9 @@ class TestBinaryOps(unittest.TestCase): def setUp(self): self.set = Set((2, 4, 6)) + def test_eq(self): # SF bug 643115 + self.assertEqual(self.set, Set({2:1,4:3,6:5})) + def test_union_subset(self): result = self.set | Set([2]) self.assertEqual(result, Set((2, 4, 6)))