Exceptions in 'siped' C++ code. ( Was: [PyKDE] Bug khtml.Node.parentNode() ? )

Mateusz Korniak mateusz at ant.gliwice.pl
Sat Apr 19 13:31:01 BST 2003


Thanks a lot for your answer, Jim

On Saturday 19 of April 2003 00:13, Jim Bublitz wrote:
> (...)
> Here's the underlying C++ code:
>
> Node Node::parentNode() const
> {
>     if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
>     return impl->parentNode();
> }
>
> bool Node::isNull() const
> {
>     return (impl == 0);
> }
>
> Since isNull() returns 1 just before the crash, it's safe to say
> impl == 0. When that's true, parentNode() throws a C++ exception
> which *doesn't* propagate into Python, and the crash happens.

I see. 
But not always one is able to predict (and fullfil) conditions when C++ code 
runs wihout raising any exceptions.
1. Is there any way to get known if such exception was raised ?
2. What is returned as function return value when exception is raised ?
3. Why C++ exceptions are not propagated to Python space ? (I suspect is 
difficult in programming sense ?)

I have tried to reach some info about it but failed :/

> I like the look of the web page, even if I can't read Polish.

Thanks, I forwarded Yours opinion to our webmaster :)

-- 
Mateusz Korniak
"Black holes are where God divided by zero." - Steven Wright




More information about the PyQt mailing list