Message321813
> 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;
} |
|
Date |
User |
Action |
Args |
2018-07-17 11:25:25 | vstinner | set | recipients:
+ vstinner, scoder, nedbat, serhiy.storchaka, ZackerySpytz, miss-islington |
2018-07-17 11:25:25 | vstinner | set | messageid: <1531826725.02.0.56676864532.issue34068@psf.upfronthosting.co.za> |
2018-07-17 11:25:25 | vstinner | link | issue34068 messages |
2018-07-17 11:25:24 | vstinner | create | |
|