summaryrefslogtreecommitdiffstats
path: root/Modules/_io
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-17 23:41:08 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-17 23:41:08 (GMT)
commitace47d7efd2e2ab708fdc25936e9a8f85e08b6d3 (patch)
tree6493906040cfe23cb98638bdb712226479730ad7 /Modules/_io
parente9af4cfaced93ea9ec37bb448dd57b8c2014bdaf (diff)
downloadcpython-ace47d7efd2e2ab708fdc25936e9a8f85e08b6d3.zip
cpython-ace47d7efd2e2ab708fdc25936e9a8f85e08b6d3.tar.gz
cpython-ace47d7efd2e2ab708fdc25936e9a8f85e08b6d3.tar.bz2
Issue #18408: PyEval_EvalFrameEx() and PyEval_CallObjectWithKeywords() now fail
with an assertion error if they are called with an exception set (PyErr_Occurred()). If these functions are called with an exception set, the exception may be cleared and so the caller looses its exception. Add also assertions to PyEval_CallObjectWithKeywords() and call_function() to check if the function succeed with no exception set, or the function failed with an exception set.
Diffstat (limited to 'Modules/_io')
-rw-r--r--Modules/_io/bufferedio.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index ad1aa48..6a885cf 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -663,6 +663,11 @@ static void
_set_BlockingIOError(char *msg, Py_ssize_t written)
{
PyObject *err;
+#ifdef Py_DEBUG
+ /* in debug mode, PyEval_EvalFrameEx() fails with an assertion error
+ if an exception is set when it is called */
+ PyErr_Clear();
+#endif
err = PyObject_CallFunction(PyExc_BlockingIOError, "isn",
errno, msg, written);
if (err)