New submission from Serhiy Storchaka:

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.

----------
components: Interpreter Core
files: free_after_iterating.patch
keywords: patch
messages: 261263
nosy: rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Double deallocation on iterator exhausting
type: crash
versions: Python 2.7, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file42080/free_after_iterating.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26494>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to