STINNER Victor <vstin...@redhat.com> added the comment:
> 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: Stefan, Serhiy: any opinion on my idea? For example, PyObject_HasAttr() can replace and clear the current exception *by design*. This function does more or less: try: obj.attr; return True except AttributeError: return False int PyObject_HasAttr(PyObject *v, PyObject *name) { PyObject *res; if (_PyObject_LookupAttr(v, name, &res) < 0) { PyErr_Clear(); return 0; } if (res == NULL) { return 0; } Py_DECREF(res); return 1; } ---------- _______________________________________ 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