[lxml-dev] parser target exception recovery bug?

Stefan Behnel stefan_ml at behnel.de
Wed Jun 17 18:40:28 CEST 2009


D.Hendriks (Dennis) wrote:
> In case of multiple exceptions, you could create an instance of yet another
> exception, containing the 'multiple exceptions'. This could for instance 
> be called MultiParseException or whatever. This would work for both 
> Python 2.x and Python 3.x...

No, not that easily. 1) I deem the first exception more important than the
one raised by .close(), and 2) the user may anticipate or even control the
exception being raised, so raising a different one may miss a well-forged
except statement in user code.

I actually mixed up the way exception chaining works in Py3. It's right to
always raise the first exception in both Py2 and Py3, and attach the second
exception only in Py3. The Python code snippets I gave were correct, though.

> Anyway, let me know what you decide and when it will be in SVN. Thanks!

No schedule yet. Could you file a bug report for now?

Stefan


More information about the lxml-dev mailing list