mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
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.
This commit is contained in:
parent
e9af4cface
commit
ace47d7efd
3 changed files with 42 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue