[PyKDE] exception handling problems with sip

Jacob M. Burbach jacobb at cfl.rr.com
Mon Apr 10 21:50:22 BST 2006


Was hesitant to post to list about this being unsure if its actually a problem 
with sip(the generated code look fine). But after a series of tests the 
problem only arises when using sip so...

I'm wrapping a C++ library which makes heavy use of exceptions for its error 
handling, theres a base Exception class which more specific exceptions are 
derived from. 

Everything seemed to be working fine, until building the extension module 
without debug symbols. Without debug the exceptions were no longer caught and 
cause the program to abort. For some reason, when built without debug, all 
exceptions are then received ONLY as the base Exception class.

try {
	throw SpecificException();
}
catch (SpecificException& sipExceptionRef) {
	// Works as expected when built with debug symbols.
	// NOT caught when built without debug symbols.
	...
}

I am really confused about what is going on here...

I've put together a small test package containing a tiny C++ library that 
throws exceptions, along with the sip files to build a wrapper for it. I also 
included handwritten python wrapper to show that the problem is only when 
using sip. See the README in the package for more details...

http://home.cfl.rr.com/filedump/sip_exception_testcase.tar.bz2

using sip 4.4.1 and Python 2.4




More information about the PyQt mailing list