From: Marcelo M. <mar...@us...> - 2006-03-27 21:39:59
|
Update of /cvsroot/swig/SWIG/Lib/python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32197/Lib/python Modified Files: director.swg director_h.swg Log Message: fix for old VC 6.0 and linking issue reported by Roy Sutton Index: director_h.swg =================================================================== RCS file: /cvsroot/swig/SWIG/Lib/python/director_h.swg,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** director_h.swg 7 Mar 2006 00:35:17 -0000 1.18 --- director_h.swg 27 Mar 2006 21:39:49 -0000 1.19 *************** *** 195,219 **** }; - - /* unknown exception handler */ - class UnknownExceptionHandler - { - static void handler(); - public: - - #ifdef SWIG_DIRECTOR_UEH - std::unexpected_handler old; - UnknownExceptionHandler(std::unexpected_handler nh = handler) - { - old = std::set_unexpected(nh); - } - - ~UnknownExceptionHandler() - { - std::set_unexpected(old); - } - #endif - }; - /* base class for director exceptions */ class DirectorException { --- 195,198 ---- *************** *** 253,256 **** --- 232,277 ---- }; + /* unknown exception handler */ + class UnknownExceptionHandler + { + #ifdef SWIG_DIRECTOR_UEH + static void handler() { + try { + throw; + } catch (DirectorException& e) { + std::cerr << "Swig Director exception caught:" << std::endl + << e.getMessage() << std::endl; + } catch (std::exception& e) { + std::cerr << "std::exception caught: "<< e.what() << std::endl; + } catch (...) { + std::cerr << "Unknown exception caught." << std::endl; + } + + std::cerr << std::endl + << "Python interpreter traceback:" << std::endl; + PyErr_Print(); + std::cerr << std::endl; + + std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl + << "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl + << std::endl + << "Exception is being re-thrown, program will like abort/terminate." << std::endl; + throw; + } + + public: + + std::unexpected_handler old; + UnknownExceptionHandler(std::unexpected_handler nh = handler) + { + old = std::set_unexpected(nh); + } + + ~UnknownExceptionHandler() + { + std::set_unexpected(old); + } + #endif + }; /* type mismatch in the return value from a python method call */ Index: director.swg =================================================================== RCS file: /cvsroot/swig/SWIG/Lib/python/director.swg,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** director.swg 7 Mar 2006 00:35:17 -0000 1.17 --- director.swg 27 Mar 2006 21:39:49 -0000 1.18 *************** *** 39,66 **** - void UnknownExceptionHandler::handler() { - try { - throw; - } catch (DirectorException& e) { - std::cerr << "Swig Director exception caught:" << std::endl - << e.getMessage() << std::endl; - } catch (std::exception& e) { - std::cerr << "std::exception caught: "<< e.what() << std::endl; - } catch (...) { - std::cerr << "Unknown exception caught." << std::endl; - } - - std::cerr << std::endl - << "Python interpreter traceback:" << std::endl; - PyErr_Print(); - std::cerr << std::endl; - - std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl - << "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl - << std::endl - << "Exception is being re-thrown, program will like abort/terminate." << std::endl; - throw; - } - } --- 39,42 ---- |