[Python-checkins] cpython: Note the new debug assertion in PyObject_Str

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


http://hg.python.org/cpython/rev/2b3b298091fa
changeset: 89077:2b3b298091fa
user: Nick Coghlan <ncoghlan at gmail.com>
date: Sun Feb 09 10:57:34 2014 +1000
summary:
 Note the new debug assertion in PyObject_Str
files:
 Doc/c-api/object.rst | 4 ++++
 Doc/whatsnew/3.4.rst | 7 +++++++
 2 files changed, 11 insertions(+), 0 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
@@ -170,6 +170,10 @@
 Python expression ``str(o)``. Called by the :func:`str` built-in function
 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.
+
 .. c:function:: PyObject* PyObject_Bytes(PyObject *o)
 
 .. index:: builtin: bytes
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,6 +1708,13 @@
 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
+ 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.
+
 * :c:func:`PyErr_SetImportError` now sets :exc:`TypeError` when its **msg**
 argument is not set. Previously only ``NULL`` was returned with no exception
 set.
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /