Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3d7b364

Browse files
committed
Note the new debug assertion in PyObject_Str
1 parent d979e43 commit 3d7b364

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

Doc/c-api/object.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ Object Protocol
170170
Python expression ``str(o)``. Called by the :func:`str` built-in function
171171
and, therefore, by the :func:`print` function.
172172
173+
.. versionchanged:: 3.4
174+
This function now includes a debug assertion that ensures it does not
175+
silently discard an active exception.
176+
173177
.. c:function:: PyObject* PyObject_Bytes(PyObject *o)
174178
175179
.. index:: builtin: bytes

Doc/whatsnew/3.4.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,6 +1708,13 @@ Changes in the Python API
17081708
Changes in the C API
17091709
--------------------
17101710

1711+
* :c:func:`PyObject_Str` now includes a debug assertion that ensures it will
1712+
no longer silently discard currently active exceptions. In cases where
1713+
discarding the active exception is expected and desired (for example,
1714+
because it has already been saved locally with :c:func:`PyErr_Fetch`), an
1715+
explicit :c:func:`PyErr_Clear` call will be needed to avoid triggering the
1716+
assertion.
1717+
17111718
* :c:func:`PyErr_SetImportError` now sets :exc:`TypeError` when its **msg**
17121719
argument is not set. Previously only ``NULL`` was returned with no exception
17131720
set.

0 commit comments

Comments
 (0)