[lxml-dev] (re-raising) exceptions problem in lxml 2.2beta4

Stefan Behnel stefan_ml at behnel.de
Tue Mar 3 14:29:36 CET 2009


Hi,

jholg at gmx.de wrote:
> I just ran into a problem with some code that re-raises exceptions,
> where accessing sys.exc_info() returns (None, None, None) instead
> of the expected most recent exception information.
> This seems to happen if "some operation" is performed on the tree

"some operation" being something that raises an exception internally, such
as StopIteration. So it's not really the "most recent exception" that you
get, but only the last exception that you caught in your frame.


> Now, I seem to remember some discussion of changes wrt to exceptions for
> lxml 2.2. Might this be an (unwanted) side effect to these changes?

Yes, it's related, and it's definitely a side-effect in Python 2. I wonder
what your example does in Py3...

Looks like Cython needs some version specific code here. Pretty hard to
get these things right in a portable way...

Stefan



More information about the lxml-dev mailing list