From c82fc4b990d69ca18e31e4544a8904e162b50217 Mon Sep 17 00:00:00 2001 From: Damien-Chen Date: Thu, 24 Oct 2024 08:51:57 +0800 Subject: [PATCH] Update PyObject_HasAttr exception behavior --- Doc/c-api/object.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst index 630114a4339110..1c23e1a8a3d5d1 100644 --- a/Doc/c-api/object.rst +++ b/Doc/c-api/object.rst @@ -111,7 +111,8 @@ Object Protocol .. note:: Exceptions that occur when this calls :meth:`~object.__getattr__` and - :meth:`~object.__getattribute__` methods are silently ignored. + :meth:`~object.__getattribute__` methods aren't propagated, + but instead given to :func:`sys.unraisablehook`. For proper error handling, use :c:func:`PyObject_HasAttrWithError`, :c:func:`PyObject_GetOptionalAttr` or :c:func:`PyObject_GetAttr` instead.