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 vstinner
Recipients nedbat, scoder, serhiy.storchaka, vstinner
Date 2018-07-11.15:05:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1531321506.6.0.56676864532.issue34068@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-07-11 15:05:06vstinnersetrecipients: + vstinner, scoder, nedbat, serhiy.storchaka
2018-07-11 15:05:06vstinnersetmessageid: <1531321506.6.0.56676864532.issue34068@psf.upfronthosting.co.za>
2018-07-11 15:05:06vstinnerlinkissue34068 messages
2018-07-11 15:05:06vstinnercreate