summaryrefslogtreecommitdiffstats
path: root/Include/object.h
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-07-11 19:13:27 (GMT)
committerGitHub <noreply@github.com>2023-07-11 19:13:27 (GMT)
commit579aa89e68a6607398317a50586af781981e89fb (patch)
tree9f12badb2781f6af3fcc73ef65a940e885b5683a /Include/object.h
parentcabd6e8a107127ff02f0b514148f648fb2472a58 (diff)
downloadcpython-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/object.h')
-rw-r--r--Include/object.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/Include/object.h b/Include/object.h
index dccab07..7f2e4e9 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -394,6 +394,10 @@ PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, const char *, PyObject *);
PyAPI_FUNC(int) PyObject_DelAttrString(PyObject *v, const char *name);
PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *);
PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *);
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000
+PyAPI_FUNC(int) PyObject_GetOptionalAttr(PyObject *, PyObject *, PyObject **);
+PyAPI_FUNC(int) PyObject_GetOptionalAttrString(PyObject *, const char *, PyObject **);
+#endif
PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *);
PyAPI_FUNC(int) PyObject_DelAttr(PyObject *v, PyObject *name);
PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *);