Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-102192: deprecate _PyErr_ChainExceptions #102935

Merged
merged 7 commits into from
Apr 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,10 @@ New Features
This is less error prone and a bit more efficient.
(Contributed by Mark Shannon in :gh:`101578`.)

* Add ``_PyErr_ChainExceptions1``, which takes an exception instance,
to replace the legacy-API ``_PyErr_ChainExceptions``, which is now
deprecated. (Contributed by Mark Shannon in :gh:`101578`.)

* Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs`
as convenience functions for retrieving and modifying
the :attr:`~BaseException.args` passed to the exception's constructor.
Expand Down Expand Up @@ -1121,6 +1125,8 @@ Deprecated
* :c:func:`PyErr_Display` is deprecated. Use :c:func:`PyErr_DisplayException`
instead. (Contributed by Irit Katriel in :gh:`102755`).

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

Removed
-------
Expand Down
2 changes: 1 addition & 1 deletion Include/cpython/pyerrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ PyAPI_FUNC(void) _PyErr_GetExcInfo(PyThreadState *, PyObject **, PyObject **, Py

/* Context manipulation (PEP 3134) */

PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is marked as an API function, so it will need to be added to the "porting to 3.12" section and any other relevant sections in the "what's new".

Py_DEPRECATED(3.12) PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
PyAPI_FUNC(void) _PyErr_ChainExceptions1(PyObject *);

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