Antoine Pitrou added the comment: > olditem is not useful
It is. Py_XDECREF() may have massive side effects (such as calling a __del__ method and executing arbitrary code). Therefore, you have to ensure that the tuple item is set to the new value *before* the old value is DECREF'ed. Otherwise, any code invoked by Py_XDECREF will see invalid tuple contents, and the interpreter may crash. ---------- nosy: +pitrou _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20945> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com