STINNER Victor <[email protected]> added the comment:
I added _Py_CheckFunctionResult() to every C calls. This function calls
PyErr_Occurred() after a function call. This change has been made in Python
3.5: bpo-23571. I made this change because it was very difficult to identify
bugs when an exception was raised but the bug was only spotted "later". Some
exceptions were ignored by mistakes.
I also added a *lot* of assertions like the following one, but only when Python
is built in debug mode:
#ifdef Py_DEBUG
/* type_call() must not be called with an exception set,
because it may clear it (directly or indirectly) and so the
caller loses its exception */
assert(!PyErr_Occurred());
#endif
commit 4a7cc8847276df27c8f52987cda619ca279687c2
Author: Victor Stinner <[email protected]>
Date: Fri Mar 6 23:35:27 2015 +0100
Issue #23571: PyObject_Call(), PyCFunction_Call() and call_function() now
raise a SystemError if a function returns a result and raises an exception.
The SystemError is chained to the previous exception.
Refactor also PyObject_Call() and PyCFunction_Call() to make them more
readable.
Remove some checks which became useless (duplicate checks).
Change reviewed by Serhiy Storchaka.
commit efde146b0c42f2643f96d00896c99a90d501fb69
Author: Victor Stinner <[email protected]>
Date: Sat Mar 21 15:04:43 2015 +0100
Issue #23571: _Py_CheckFunctionResult() now gives the name of the function
which returned an invalid result (result+error or no result without error)
in
the exception message.
Add also unit test to check that the exception contains the name of the
function.
Special case: the final _PyEval_EvalFrameEx() check doesn't mention the
function since it didn't execute a single function but a whole frame.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35711>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com