Message290859
What happens when you don't have the assert depends on whether the new function call raises an exception or not, and keep in mind *this is what most people see anyway*: if the new call does not raise an exception, a SystemError is raised, with the original exception as cause:
Traceback (most recent call last):
File "<stdin>", line 5, in func
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
SystemError: PyEval_EvalFrameEx returned a result with an error set
If the new call does raise an exception, the original exception is lost (although this may depend on the exact path through the code here; there's quite a few places that deal with this kind of thing.)
I don't mind dropping the assert changes from my PR, but I don't really understand why it is better to be *less* helpful when asserts are enabled :) As I said, the actual assert failure does very little to point to the real problem, as the problem is *some* extension module not clearing the error (or not returning an error value), and the assert does not guard against actual problems -- nothing goes "more wrong" when the assert is not there. I would also argue that an extension module is not *internal* to CPython, any more than arguments passed to a builtin function are. |
|
Date |
User |
Action |
Args |
2017-03-30 16:29:08 | twouters | set | recipients:
+ twouters, tim.peters, gregory.p.smith, vstinner, serhiy.storchaka, Thomas Wouters |
2017-03-30 16:29:08 | twouters | set | messageid: <1490891348.19.0.780423856582.issue29941@psf.upfronthosting.co.za> |
2017-03-30 16:29:08 | twouters | link | issue29941 messages |
2017-03-30 16:29:08 | twouters | create | |
|