From 92d06b9e8fee7579a58eb148b84ac83273f8c134 Mon Sep 17 00:00:00 2001 From: Yuki Kobayashi Date: Thu, 19 Jun 2025 02:07:22 +0000 Subject: [PATCH 1/3] Docs: Document `PyExceptionClass_Name` `PyExceptionClass_Name` is an undocumented function in the limited API. --- Doc/c-api/exceptions.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 885dbeb75303d1..6a0de575cc23ac 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -749,6 +749,11 @@ Exception Classes .. versionadded:: 3.2 +.. c:function:: const char *PyExceptionClass_Name(PyObject *ob) + + Return :c:member:`~PyTypeObject.tp_name` of the exception class *ob*. + + Exception Objects ================= From 4624f4f53876c66b7767524b6f1d471fe0768563 Mon Sep 17 00:00:00 2001 From: Yuki Kobayashi Date: Thu, 19 Jun 2025 05:23:05 +0000 Subject: [PATCH 2/3] Document `PyExceptionClass_Check` --- Doc/c-api/exceptions.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 6a0de575cc23ac..1acaeb6e3fd2ad 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -749,6 +749,11 @@ Exception Classes .. versionadded:: 3.2 +.. c:function:: int PyExceptionClass_Check(PyObject *ob) + + Return true if *ob* is an exception class. This function always succeeds. + + .. c:function:: const char *PyExceptionClass_Name(PyObject *ob) Return :c:member:`~PyTypeObject.tp_name` of the exception class *ob*. From cd9bc34d072d5fda199a061f18068ed01a2c2e3b Mon Sep 17 00:00:00 2001 From: Yuki Kobayashi Date: Thu, 19 Jun 2025 22:19:12 +0900 Subject: [PATCH 3/3] Update Doc/c-api/exceptions.rst Co-authored-by: Peter Bierma --- Doc/c-api/exceptions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 1acaeb6e3fd2ad..a750cda3e2d474 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -751,7 +751,7 @@ Exception Classes .. c:function:: int PyExceptionClass_Check(PyObject *ob) - Return true if *ob* is an exception class. This function always succeeds. + Return non-zero if *ob* is an exception class, zero otherwise. This function always succeeds. .. c:function:: const char *PyExceptionClass_Name(PyObject *ob)