Re: [xml] Aborting html sax parsing from python

Daniel Veillard wrote:

  Okay so the exception unwinds though the C code.
Seems though that there is a lot of work to get all cases covered,
needs to modify the handler.

Hmm, right. As these handlers don't return anything, may be it would
be better to reserve such a fail-bit in the context object that is being
passed around with each call ?

What happen in case of multithreaded apps ? the global variable is a
potentially serious problem if you do a complex setup.

The global exception variable is part of the python runtime, so let python
care for it. :-)
(That's what python's internal 'Global Interpreter Lock' is used for.)

The critical thing is thus to check for callback failure. There is nothing special you have to do to pass the exception through, since both the callbacks and the application code share the same python runtime, i.e. see the same state that stores the exception

  This doesn't look that easy to implement right, there is a number of
pitfall I believe. I won't have time to do this in the foreseable future, but
if you want to work on it, I take patches :-)

Fair enough.


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