mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +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
|
@ -2426,6 +2426,24 @@ PyMapping_SetItemString(PyObject *o, const char *key, PyObject *value)
|
|||
return r;
|
||||
}
|
||||
|
||||
int
|
||||
PyMapping_HasKeyStringWithError(PyObject *obj, const char *key)
|
||||
{
|
||||
PyObject *res;
|
||||
int rc = PyMapping_GetOptionalItemString(obj, key, &res);
|
||||
Py_XDECREF(res);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
PyMapping_HasKeyWithError(PyObject *obj, PyObject *key)
|
||||
{
|
||||
PyObject *res;
|
||||
int rc = PyMapping_GetOptionalItem(obj, key, &res);
|
||||
Py_XDECREF(res);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
PyMapping_HasKeyString(PyObject *o, const char *key)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue