Skip to content

Commit 5b9573e

Browse files
gh-101578: Fixup NEWS and add What's New entry for new exception APIs (#102157)
1 parent 22b8d77 commit 5b9573e

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

Doc/whatsnew/3.12.rst

+18
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,19 @@ New Features
870870
get a frame variable by its name.
871871
(Contributed by Victor Stinner in :gh:`91248`.)
872872

873+
* Add :c:func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException`
874+
for saving and restoring the current exception.
875+
These functions return and accept a single exception object,
876+
rather than the triple arguments of the now-deprecated
877+
:c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore`.
878+
This is less error prone and a bit more efficient.
879+
(Contributed by Mark Shannon in :gh:`101578`.)
880+
881+
* Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs`
882+
as convenience functions for retrieving and modifying
883+
the :attr:`~BaseException.args` passed to the exception's constructor.
884+
(Contributed by Mark Shannon in :gh:`101578`.)
885+
873886
Porting to Python 3.12
874887
----------------------
875888

@@ -993,6 +1006,11 @@ Deprecated
9931006
(Contributed in :gh:`47146` by Petr Viktorin, based on
9941007
earlier work by Alexander Belopolsky and Matthias Braun.)
9951008

1009+
* :c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated.
1010+
Use :c:func:`PyErr_GetRaisedException` and
1011+
:c:func:`PyErr_SetRaisedException` instead.
1012+
(Contributed by Mark Shannon in :gh:`101578`.)
1013+
9961014

9971015
Removed
9981016
-------
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
Add new C-API functions for saving and restoring the current exception:
2-
``PyErr_GetRaisedException`` and ``PyErr_SetRaisedException``.
3-
These functions take and return a single exception rather than
4-
the triple of ``PyErr_Fetch`` and ``PyErr_Restore``.
1+
Add :c:func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException`
2+
for saving and restoring the current exception.
3+
These functions return and accept a single exception object,
4+
rather than the triple arguments of the now-deprecated
5+
:c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore`.
56
This is less error prone and a bit more efficient.
67

7-
The three arguments forms of saving and restoring the
8-
current exception: ``PyErr_Fetch`` and ``PyErr_Restore``
9-
are deprecated.
10-
11-
Also add ``PyException_GetArgs`` and ``PyException_SetArgs``
12-
as convenience functions to help dealing with
13-
exceptions in the C API.
8+
Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs`
9+
as convenience functions for retrieving and modifying
10+
the :attr:`~BaseException.args` passed to the exception's constructor.

0 commit comments

Comments
 (0)