Skip to content

Commit 95f3ddd

Browse files
gh-142410: Soft-deprecate PyException_HEAD in C API docs
1 parent 6665115 commit 95f3ddd

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Doc/c-api/exceptions.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -795,11 +795,15 @@ Exception Classes
795795

796796
.. c:macro:: PyException_HEAD
797797

798-
This is a :term:`soft deprecated` macro including the base fields for an
799-
exception object.
798+
Include the base fields for an exception object.
800799

801-
This was included in Python's C API by mistake and is not designed for use
802-
in extensions. For creating custom exception objects, use
800+
.. deprecated:: 3.14
801+
``PyException_HEAD`` is an internal implementation detail that was not
802+
intended to be exposed as part of the python C API and is not designed
803+
for use by third-party extensions.
804+
805+
The macro may be changed or removed in a future Python version.
806+
Extensions authors should instead create exception class using
803807
:c:func:`PyErr_NewException` or otherwise create a class inheriting from
804808
:c:data:`PyExc_BaseException`.
805809

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Soft-deprecate the ``PyException_HEAD`` macro in the C API documentation.
2+
The macro is an internal implementation detail and should not be used by
3+
third-party extensions.

0 commit comments

Comments
 (0)