msg261263 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-03-06 18:26 |
Following example causes double deallocation of a sequence and crashing. class A(list): def __del__(self): next(it) it = iter(A()) next(it) The same is for subclass of tuple, str, bytes and bytearray. Proposed patch fixes this issue. |
|
|
msg261270 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-03-06 20:23 |
Updated patch fixes also set, dict and os.scandir() iterator. May be sqlite3 cursor needs a fix, but it is too complicated. |
|
|
msg261343 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-03-08 11:01 |
TODO: After resolving add the test for array. |
|
|
msg261348 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-03-08 11:26 |
Fixed test for OrderedDict. Tests for list and tuple are moved up to seq_tests.py. |
|
|
msg261420 - (view) |
Author: Filipp Andjelo (scorp) |
Date: 2016-03-09 12:29 |
Hi Serhiy, I tried the short example you gave, but it doesn't crash. I'm getting: Exception ignored in: <bound method A.__del__ of []> Traceback (most recent call last): File "./test.py", line 5, in __del__ next(it) StopIteration Exception ignored in: <bound method A.__del__ of []> Traceback (most recent call last): File "./test.py", line 5, in __del__ next(it) StopIteration Traceback (most recent call last): File "./test.py", line 8, in next(it) StopIteration Am I missing something? |
|
|
msg261426 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-03-09 14:06 |
It crashes in debug build. |
|
|
msg261734 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-03-14 08:58 |
Could anyone please look at the patch? I'm not sure about organizing tests. |
|
|
msg262675 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2016-03-30 17:44 |
New changeset 905b5944119c by Serhiy Storchaka in branch '3.5': Issue #26494: Fixed crash on iterating exhausting iterators. https://hg.python.org/cpython/rev/905b5944119c New changeset 73ce47d4a7b2 by Serhiy Storchaka in branch 'default': Issue #26494: Fixed crash on iterating exhausting iterators. https://hg.python.org/cpython/rev/73ce47d4a7b2 New changeset cff06d875678 by Serhiy Storchaka in branch '2.7': Issue #26494: Fixed crash on iterating exhausting iterators. https://hg.python.org/cpython/rev/cff06d875678 |
|
|