diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2023-07-11 19:13:27 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-11 19:13:27 (GMT) |
| commit | 579aa89e68a6607398317a50586af781981e89fb (patch) | |
| tree | 9f12badb2781f6af3fcc73ef65a940e885b5683a /Include/cpython | |
| parent | cabd6e8a107127ff02f0b514148f648fb2472a58 (diff) | |
| download | cpython-579aa89e68a6607398317a50586af781981e89fb.zip cpython-579aa89e68a6607398317a50586af781981e89fb.tar.gz cpython-579aa89e68a6607398317a50586af781981e89fb.tar.bz2 | |
gh-106521: Add PyObject_GetOptionalAttr() function (GH-106522)
It is a new name of former _PyObject_LookupAttr().
Add also PyObject_GetOptionalAttrString().
Diffstat (limited to 'Include/cpython')
| -rw-r--r-- | Include/cpython/object.h | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/Include/cpython/object.h b/Include/cpython/object.h index ef90064..ba30c56 100644 --- a/Include/cpython/object.h +++ b/Include/cpython/object.h @@ -294,17 +294,7 @@ PyAPI_FUNC(int) _PyObject_IsFreed(PyObject *); PyAPI_FUNC(int) _PyObject_IsAbstract(PyObject *); PyAPI_FUNC(PyObject *) _PyObject_GetAttrId(PyObject *, _Py_Identifier *); PyAPI_FUNC(int) _PyObject_SetAttrId(PyObject *, _Py_Identifier *, PyObject *); -/* Replacements of PyObject_GetAttr() and _PyObject_GetAttrId() which - don't raise AttributeError. - - Return 1 and set *result != NULL if an attribute is found. - Return 0 and set *result == NULL if an attribute is not found; - an AttributeError is silenced. - Return -1 and set *result == NULL if an error other than AttributeError - is raised. -*/ -PyAPI_FUNC(int) _PyObject_LookupAttr(PyObject *, PyObject *, PyObject **); -PyAPI_FUNC(int) _PyObject_LookupAttrId(PyObject *, _Py_Identifier *, PyObject **); +#define _PyObject_LookupAttr PyObject_GetOptionalAttr PyAPI_FUNC(int) _PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); |
