diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-18 11:57:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-18 11:57:17 (GMT) |
commit | 3fcc1e08db6fb7e17acc4a8f63be3e42f52f094b (patch) | |
tree | 4f142af24eb8ba7869649598ac36be5aa35e192d /Doc/c-api/object.rst | |
parent | 62a68b762a479a72c3defba9ace5f72a0063c5c6 (diff) | |
download | cpython-3fcc1e08db6fb7e17acc4a8f63be3e42f52f094b.zip cpython-3fcc1e08db6fb7e17acc4a8f63be3e42f52f094b.tar.gz cpython-3fcc1e08db6fb7e17acc4a8f63be3e42f52f094b.tar.bz2 |
bpo-35461: Document C API functions which suppress exceptions. (GH-11119)
Diffstat (limited to 'Doc/c-api/object.rst')
-rw-r--r-- | Doc/c-api/object.rst | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst index f0b2005..a64ff2e 100644 --- a/Doc/c-api/object.rst +++ b/Doc/c-api/object.rst @@ -33,6 +33,10 @@ Object Protocol is equivalent to the Python expression ``hasattr(o, attr_name)``. This function always succeeds. + Note that exceptions which occur while calling :meth:`__getattr__` and + :meth:`__getattribute__` methods will get suppressed. + To get error reporting use :c:func:`PyObject_GetAttr()` instead. + .. c:function:: int PyObject_HasAttrString(PyObject *o, const char *attr_name) @@ -40,6 +44,11 @@ Object Protocol is equivalent to the Python expression ``hasattr(o, attr_name)``. This function always succeeds. + Note that exceptions which occur while calling :meth:`__getattr__` and + :meth:`__getattribute__` methods and creating a temporary string object + will get suppressed. + To get error reporting use :c:func:`PyObject_GetAttrString()` instead. + .. c:function:: PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name) |