Skip to content

Commit 06249ec

Browse files
authoredApr 1, 2023
gh-102192: deprecate _PyErr_ChainExceptions (#102935)
1 parent 848bdbe commit 06249ec

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed
 

‎Doc/whatsnew/3.12.rst

+6
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,10 @@ New Features
975975
This is less error prone and a bit more efficient.
976976
(Contributed by Mark Shannon in :gh:`101578`.)
977977

978+
* Add ``_PyErr_ChainExceptions1``, which takes an exception instance,
979+
to replace the legacy-API ``_PyErr_ChainExceptions``, which is now
980+
deprecated. (Contributed by Mark Shannon in :gh:`101578`.)
981+
978982
* Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs`
979983
as convenience functions for retrieving and modifying
980984
the :attr:`~BaseException.args` passed to the exception's constructor.
@@ -1125,6 +1129,8 @@ Deprecated
11251129
* :c:func:`!PyErr_Display` is deprecated. Use :c:func:`PyErr_DisplayException`
11261130
instead. (Contributed by Irit Katriel in :gh:`102755`).
11271131

1132+
* ``_PyErr_ChainExceptions`` is deprecated. Use ``_PyErr_ChainExceptions1``
1133+
instead. (Contributed by Irit Katriel in :gh:`102192`.)
11281134

11291135
Removed
11301136
-------

‎Include/cpython/pyerrors.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ PyAPI_FUNC(void) _PyErr_GetExcInfo(PyThreadState *, PyObject **, PyObject **, Py
9898

9999
/* Context manipulation (PEP 3134) */
100100

101-
PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
101+
Py_DEPRECATED(3.12) PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
102102
PyAPI_FUNC(void) _PyErr_ChainExceptions1(PyObject *);
103103

104104
/* Like PyErr_Format(), but saves current exception as __context__ and
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Deprecated ``_PyErr_ChainExceptions`` in favour of
2+
``_PyErr_ChainExceptions1``.

0 commit comments

Comments
 (0)
Please sign in to comment.