diff options
author | Raymond Hettinger <python@rcn.com> | 2016-01-27 05:44:16 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2016-01-27 05:44:16 (GMT) |
commit | 3743432302e9b31d4fe0db31485543a306057fc8 (patch) | |
tree | 44b17d2b0ee2b6d75db1aaa4c931527ab1a35020 /Lib/test/test_deque.py | |
parent | d4e51f45a9b82832e95dcc55ba0d8f53ca725824 (diff) | |
download | cpython-3743432302e9b31d4fe0db31485543a306057fc8.zip cpython-3743432302e9b31d4fe0db31485543a306057fc8.tar.gz cpython-3743432302e9b31d4fe0db31485543a306057fc8.tar.bz2 |
Issue #26194: Fix undefined behavior for deque.insert() when len(d) == maxlen
Diffstat (limited to 'Lib/test/test_deque.py')
-rw-r--r-- | Lib/test/test_deque.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_deque.py b/Lib/test/test_deque.py index 8718716..d2a4633 100644 --- a/Lib/test/test_deque.py +++ b/Lib/test/test_deque.py @@ -304,6 +304,20 @@ class TestBasic(unittest.TestCase): s.insert(i, 'Z') self.assertEqual(list(d), s) + def test_index_bug_26194(self): + data = 'ABC' + for i in range(len(data) + 1): + d = deque(data, len(data)) + d.insert(i, None) + s = list(data) + s.insert(i, None) + s.pop() + self.assertEqual(list(d), s) + if i < len(data): + self.assertIsNone(d[i]) + else: + self.assertTrue(None not in d) + def test_imul(self): for n in (-10, -1, 0, 1, 2, 10, 1000): d = deque() |