Skip to content

Commit 57a254d

Browse files
iritkatrielwarsaw
authored andcommitted
pythongh-102192: deprecate _PyErr_ChainExceptions (python#102935)
1 parent 756ba73 commit 57a254d

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
@@ -978,6 +978,10 @@ New Features
978978
This is less error prone and a bit more efficient.
979979
(Contributed by Mark Shannon in :gh:`101578`.)
980980

981+
* Add ``_PyErr_ChainExceptions1``, which takes an exception instance,
982+
to replace the legacy-API ``_PyErr_ChainExceptions``, which is now
983+
deprecated. (Contributed by Mark Shannon in :gh:`101578`.)
984+
981985
* Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs`
982986
as convenience functions for retrieving and modifying
983987
the :attr:`~BaseException.args` passed to the exception's constructor.
@@ -1128,6 +1132,8 @@ Deprecated
11281132
* :c:func:`!PyErr_Display` is deprecated. Use :c:func:`PyErr_DisplayException`
11291133
instead. (Contributed by Irit Katriel in :gh:`102755`).
11301134

1135+
* ``_PyErr_ChainExceptions`` is deprecated. Use ``_PyErr_ChainExceptions1``
1136+
instead. (Contributed by Irit Katriel in :gh:`102192`.)
11311137

11321138
Removed
11331139
-------

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)