On Thu, 30 Jun 2005 17:24:27 +0100 Phil Thompson <[EMAIL PROTECTED]> wrote:
> > 4) There are several standard exceptions which I always have to catch. > > Now I have a macro for them: > > > > #define CATCH_STD_EXCEPTIONS \ > > catch (std::bad_alloc&) {\ > > PyErr_NoMemory(); \ > > sipIsErr = 1; \ > > } catch (std::exception &exc) {\ > > PyErr_SetString(PyExc_RuntimeError, exc.what()); \ > > sipIsErr = 1; \ > > } catch (...) {\ > > PyErr_SetString(PyExc_RuntimeError, "unknown"); \ > > sipIsErr = 1; \ > > } > > > > used in %MethodCode: > > > > %MethodCode > > try { > > sipRes = someMethod(...); > > } CATCH_STD_EXCEPTIONS // sipIsErr - this comment is important hint to > > SIP! %End > > If your point is the need for the comment, then yes - consider it a feature. No, I meant these exceptions must be caught almost everywhere. So I have to add %MethodCode to almost every method, which is annoying. The latest release of SIP always catch all exceptions with "catch(...)" clause with -e option, but now it doesn't. -- Denis S. Otkidach http://www.python.ru/ [ru] _______________________________________________ PyKDE mailing list PyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde