[Python-checkins] cpython: Issue #20500: Note other public APIs with the new assertion

nick.coghlan python-checkins at python.org
Sun Feb 9 03:01:03 CET 2014


http://hg.python.org/cpython/rev/41023a501c7b
changeset:   89080:41023a501c7b
user:        Nick Coghlan <ncoghlan at gmail.com>
date:        Sun Feb 09 12:00:01 2014 +1000
summary:
  Issue #20500: Note other public APIs with the new assertion

files:
  Doc/c-api/object.rst   |   7 +++++--
  Doc/c-api/veryhigh.rst |   4 ++++
  Doc/whatsnew/3.4.rst   |  14 +++++++++-----
  3 files changed, 18 insertions(+), 7 deletions(-)


diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst
--- a/Doc/c-api/object.rst
+++ b/Doc/c-api/object.rst
@@ -149,6 +149,9 @@
    representation on success, *NULL* on failure.  This is the equivalent of the
    Python expression ``repr(o)``.  Called by the :func:`repr` built-in function.
 
+   .. versionchanged:: 3.4
+      This function now includes a debug assertion to help ensure that it
+      does not silently discard an active exception.
 
 .. c:function:: PyObject* PyObject_ASCII(PyObject *o)
 
@@ -171,8 +174,8 @@
    and, therefore, by the :func:`print` function.
 
    .. versionchanged:: 3.4
-      This function now includes a debug assertion that ensures it does not
-      silently discard an active exception.
+      This function now includes a debug assertion to help ensure that it
+      does not silently discard an active exception.
 
 .. c:function:: PyObject* PyObject_Bytes(PyObject *o)
 
diff --git a/Doc/c-api/veryhigh.rst b/Doc/c-api/veryhigh.rst
--- a/Doc/c-api/veryhigh.rst
+++ b/Doc/c-api/veryhigh.rst
@@ -322,6 +322,10 @@
    it causes an exception to immediately be thrown; this is used for the
    :meth:`~generator.throw` methods of generator objects.
 
+   .. versionchanged:: 3.4
+      This function now includes a debug assertion to help ensure that it
+      does not silently discard an active exception.
+
 
 .. c:function:: int PyEval_MergeCompilerFlags(PyCompilerFlags *cf)
 
diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst
--- a/Doc/whatsnew/3.4.rst
+++ b/Doc/whatsnew/3.4.rst
@@ -1708,12 +1708,16 @@
 Changes in the C API
 --------------------
 
-* :c:func:`PyObject_Str` now includes a debug assertion that ensures it will
-  no longer silently discard currently active exceptions. In cases where
+* :c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr(), and
+  :c:func:`PyObject_Str`, along with some other internal C APIs, now include
+  a debugging assertion that ensures they are not used in situations where
+  they may silently discard a currently active exception. In cases where
   discarding the active exception is expected and desired (for example,
-  because it has already been saved locally with :c:func:`PyErr_Fetch`), an
-  explicit :c:func:`PyErr_Clear` call will be needed to avoid triggering the
-  assertion.
+  because it has already been saved locally with :c:func:`PyErr_Fetch` or
+  is being deliberately replaced with a different exception), an explicit
+  :c:func:`PyErr_Clear` call will be needed to avoid triggering the
+  assertion when running against a version of Python that is compiled with
+  assertions enabled.
 
 * :c:func:`PyErr_SetImportError` now sets :exc:`TypeError` when its **msg**
   argument is not set. Previously only ``NULL`` was returned with no exception

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list