summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_set.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2015-07-16 06:50:14 (GMT)
committerRaymond Hettinger <python@rcn.com>2015-07-16 06:50:14 (GMT)
commita3626bc5bddf9bf43f33060f4ea1a99f25e0c7f1 (patch)
tree269c45ad9cba4708570ab9596331bbd91e4fb7e3 /Lib/test/test_set.py
parentced770da07f9dbd7cc3afd09c2488c60faefe73c (diff)
downloadcpython-a3626bc5bddf9bf43f33060f4ea1a99f25e0c7f1.zip
cpython-a3626bc5bddf9bf43f33060f4ea1a99f25e0c7f1.tar.gz
cpython-a3626bc5bddf9bf43f33060f4ea1a99f25e0c7f1.tar.bz2
Issue #24583: Fix crash when set is mutated while being updated.
Diffstat (limited to 'Lib/test/test_set.py')
-rw-r--r--Lib/test/test_set.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py
index 9f96f87..54de508 100644
--- a/Lib/test/test_set.py
+++ b/Lib/test/test_set.py
@@ -1742,6 +1742,19 @@ class TestWeirdBugs(unittest.TestCase):
s.update(range(100))
list(si)
+ def test_merge_and_mutate(self):
+ class X:
+ def __hash__(self):
+ return hash(0)
+ def __eq__(self, o):
+ other.clear()
+ return False
+
+ other = set()
+ other = {X() for i in range(10)}
+ s = {0}
+ s.update(other)
+
# Application tests (based on David Eppstein's graph recipes ====================================
def powerset(U):