mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
gh-106672: C API: Report indiscriminately ignored errors (GH-106674)
Functions which indiscriminately ignore all errors now report them as unraisable errors.
This commit is contained in:
parent
a077b2fbb8
commit
f55cb44359
9 changed files with 195 additions and 45 deletions
|
|
@ -1040,7 +1040,10 @@ PyObject_HasAttrString(PyObject *obj, const char *name)
|
|||
{
|
||||
int rc = PyObject_HasAttrStringWithError(obj, name);
|
||||
if (rc < 0) {
|
||||
PyErr_Clear();
|
||||
PyErr_FormatUnraisable(
|
||||
"Exception ignored in PyObject_HasAttrString(); consider using "
|
||||
"PyObject_HasAttrStringWithError(), "
|
||||
"PyObject_GetOptionalAttrString() or PyObject_GetAttrString()");
|
||||
return 0;
|
||||
}
|
||||
return rc;
|
||||
|
|
@ -1275,7 +1278,10 @@ PyObject_HasAttr(PyObject *obj, PyObject *name)
|
|||
{
|
||||
int rc = PyObject_HasAttrWithError(obj, name);
|
||||
if (rc < 0) {
|
||||
PyErr_Clear();
|
||||
PyErr_FormatUnraisable(
|
||||
"Exception ignored in PyObject_HasAttr(); consider using "
|
||||
"PyObject_HasAttrWithError(), "
|
||||
"PyObject_GetOptionalAttr() or PyObject_GetAttr()");
|
||||
return 0;
|
||||
}
|
||||
return rc;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue