mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-108511: Add C API functions which do not silently ignore errors (GH-109025)
Add the following functions: * PyObject_HasAttrWithError() * PyObject_HasAttrStringWithError() * PyMapping_HasKeyWithError() * PyMapping_HasKeyStringWithError()
This commit is contained in:
parent
e57ecf6bbc
commit
add16f1a5e
28 changed files with 330 additions and 111 deletions
|
@ -245,14 +245,12 @@ get_suggestions_for_name_error(PyObject* name, PyFrameObject* frame)
|
|||
goto error;
|
||||
}
|
||||
|
||||
PyObject *value;
|
||||
res = PyObject_GetOptionalAttr(self, name, &value);
|
||||
res = PyObject_HasAttrWithError(self, name);
|
||||
Py_DECREF(locals);
|
||||
if (res < 0) {
|
||||
goto error;
|
||||
}
|
||||
if (value) {
|
||||
Py_DECREF(value);
|
||||
if (res) {
|
||||
Py_DECREF(dir);
|
||||
return PyUnicode_FromFormat("self.%U", name);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue