This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients Oren Milman, geeknik, lemburg, pitrou, serhiy.storchaka, tim.peters, twouters, vstinner
Date 2017-10-06.20:43:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <[email protected]>
In-reply-to
Content
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.
History
Date User Action Args
2017-10-06 20:43:42serhiy.storchakasetrecipients: + serhiy.storchaka, lemburg, tim.peters, twouters, pitrou, vstinner, Oren Milman, geeknik
2017-10-06 20:43:42serhiy.storchakasetmessageid: <[email protected]>
2017-10-06 20:43:42serhiy.storchakalinkissue31165 messages
2017-10-06 20:43:42serhiy.storchakacreate