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

Skip to content

Commit c0bc0b4

Browse files
committed
Issue #20500: Note other public APIs with the new assertion
1 parent 0c3949c commit c0bc0b4

3 files changed

Lines changed: 18 additions & 7 deletions

File tree

Doc/c-api/object.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ Object Protocol
149149
representation on success, *NULL* on failure. This is the equivalent of the
150150
Python expression ``repr(o)``. Called by the :func:`repr` built-in function.
151151
152+
.. versionchanged:: 3.4
153+
This function now includes a debug assertion to help ensure that it
154+
does not silently discard an active exception.
152155
153156
.. c:function:: PyObject* PyObject_ASCII(PyObject *o)
154157
@@ -171,8 +174,8 @@ Object Protocol
171174
and, therefore, by the :func:`print` function.
172175
173176
.. versionchanged:: 3.4
174-
This function now includes a debug assertion that ensures it does not
175-
silently discard an active exception.
177+
This function now includes a debug assertion to help ensure that it
178+
does not silently discard an active exception.
176179
177180
.. c:function:: PyObject* PyObject_Bytes(PyObject *o)
178181

Doc/c-api/veryhigh.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ the same library that the Python runtime is using.
322322
it causes an exception to immediately be thrown; this is used for the
323323
:meth:`~generator.throw` methods of generator objects.
324324
325+
.. versionchanged:: 3.4
326+
This function now includes a debug assertion to help ensure that it
327+
does not silently discard an active exception.
328+
325329
326330
.. c:function:: int PyEval_MergeCompilerFlags(PyCompilerFlags *cf)
327331

Doc/whatsnew/3.4.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,12 +1708,16 @@ 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
1711+
* :c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr(), and
1712+
:c:func:`PyObject_Str`, along with some other internal C APIs, now include
1713+
a debugging assertion that ensures they are not used in situations where
1714+
they may silently discard a currently active exception. In cases where
17131715
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.
1716+
because it has already been saved locally with :c:func:`PyErr_Fetch` or
1717+
is being deliberately replaced with a different exception), an explicit
1718+
:c:func:`PyErr_Clear` call will be needed to avoid triggering the
1719+
assertion when running against a version of Python that is compiled with
1720+
assertions enabled.
17171721

17181722
* :c:func:`PyErr_SetImportError` now sets :exc:`TypeError` when its **msg**
17191723
argument is not set. Previously only ``NULL`` was returned with no exception

0 commit comments

Comments
 (0)