diff options
author | sweeneyde <36520290+sweeneyde@users.noreply.github.com> | 2020-02-09 08:16:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-09 08:16:43 (GMT) |
commit | c6dedde160a9fce5d049e860f586ad8f93aec822 (patch) | |
tree | 5a1ec4cd1930b02f3db5946c40bf849abc231bbd /Lib/test/test_deque.py | |
parent | 7f6f7eef5206858030cbe4f80a7c04b02781cc9a (diff) | |
download | cpython-c6dedde160a9fce5d049e860f586ad8f93aec822.zip cpython-c6dedde160a9fce5d049e860f586ad8f93aec822.tar.gz cpython-c6dedde160a9fce5d049e860f586ad8f93aec822.tar.bz2 |
bpo-39590: make deque.__contains__ and deque.count hold strong references (GH-18421)
Diffstat (limited to 'Lib/test/test_deque.py')
-rw-r--r-- | Lib/test/test_deque.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_deque.py b/Lib/test/test_deque.py index 51b66b7..c0f7138 100644 --- a/Lib/test/test_deque.py +++ b/Lib/test/test_deque.py @@ -183,6 +183,18 @@ class TestBasic(unittest.TestCase): with self.assertRaises(RuntimeError): n in d + def test_contains_count_stop_crashes(self): + class A: + def __eq__(self, other): + d.clear() + return NotImplemented + d = deque([A(), A()]) + with self.assertRaises(RuntimeError): + _ = 3 in d + d = deque([A(), A()]) + with self.assertRaises(RuntimeError): + _ = d.count(3) + def test_extend(self): d = deque('a') self.assertRaises(TypeError, d.extend, 1) |