[issue31165] list_slice() does crash if the list is mutated indirectly by PyList_New()
Serhiy Storchaka
report at bugs.python.org
Fri Oct 6 16:43:42 EDT 2017
Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
This is different case than mutating a dict while iterate it. In this case the failure is caused by GC, and it is always hard to handle such issues. In case of a dict you can just copy it before iterating. But what to do with RuntimeError from slicing a list if copying a list is vulnerable to the same issue?
The example of yet one solution you can see in dict_keys() in dictobject.c. I always wondered why this code is needed.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31165>
_______________________________________
More information about the Python-bugs-list
mailing list