Re: [xml] using "raise" in Python error handler callbacks



Daniel Veillard wrote:
On Thu, Mar 31, 2005 at 10:25:41PM +0100, Andrew McDermott wrote:

Whilst experimenting with the Python bindings I noticed that exceptions are not propagated when using registerErrorHandler(). If I run the following I get the error message:

        /etc/passwd : failed to parse.

However, there is no Traceback for the "raise".  Is this correct?

import libxml2
import sys


  You have
    Python calling C calling Python.
the internal exception in the callback does not cross the C boundary
I don't see how this could work without disastrous side effects like
memory leaks or general instability in the program.

I don't think this is quite accurate. Think about python as a high-level
API to a C runtime. If the outer and the inner python runtimes are
the same, there is certainly a way to pass the necessary information through
(i.e. ultimately just preserve the exception state from the callback).

Regards,
                Stefan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]