[issue23188] Exception chaining should trigger for non-normalised exceptions

Nick Coghlan report at bugs.python.org
Sat Jan 10 12:13:07 CET 2015


Nick Coghlan added the comment:

Ah, confusion between "exception has been raised" and "we're in an active exception handler" is almost certainly what is happening. In both issue 22906 and my previous codec exception wrapping work, we're still in the C code that raised the exception, *before* we make it back to the eval loop and any Python level exception handling.

So I think that's the distinction we need to ensure is documented, and potentially a new public helper function provided - if you're in a Python level exception handler, then exception context chaining will be handled automatically for you in PyErr_SetObject, but if you're still in C code and haven't made it back to the eval loop after raising an exception, then you're going to have to do any exception chaining explicitly.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23188>
_______________________________________


More information about the Python-bugs-list mailing list