STINNER Victor <vstin...@redhat.com> added the comment:
Stefan Behnel: "I added this assertion exactly for the purpose of finding this kind of bug. It means that some code tried to look up an attribute with a live exception set, which previously could swallow the exception in certain situations, and even if not, it is always the wrong thing to do." The assertion failure is a little bit "far" from the bug: would it make sense to add "assert(!PyErr_Occurred());" to the entry point of: * PyObject_HasAttr() * PyObject_SetAttr() * PyObject_SetAttrString() * _PyObject_SetAttrId() * type_getattro() * slot_tp_getattr_hook() * and other similar functions? A few years ago, I added "assert(!PyErr_Occurred());" to the entry point of C functions which can call arbitrary code like _PyEval_EvalFrameDefault(), PyObject_Call(), etc. It helped to find many bugs. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34068> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com