Revision: 971
http://svn.sourceforge.net/pygccxml/?rev=971&view=rev
Author: roman_yakovenko
Date: 2007-04-05 10:57:40 -0700 (Thu, 05 Apr 2007)
Log Message:
-----------
changing exception implementation to be undependent on module location
Modified Paths:
--------------
pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.cpp
pyplusplus_dev/docs/troubleshooting_guide/exceptions/test.py
Modified: pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.cpp
===================================================================
--- pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.cpp 2007-04-05 15:55:43 UTC (rev 970)
+++ pyplusplus_dev/docs/troubleshooting_guide/exceptions/exceptions.cpp 2007-04-05 17:57:40 UTC (rev 971)
@@ -1,5 +1,6 @@
#include "boost/python.hpp"
#include <stdexcept>
+#include <iostream>
/**
* Content:
@@ -59,10 +60,10 @@
static void
translate( const application_error& err ){
- bpl::object this_module( bpl::handle<>( bpl::borrowed(PyImport_AddModule("my_exceptions"))));
- bpl::object app_exc_class = this_module.attr("application_error");
- bpl::object pyerr = app_exc_class( err );
- PyErr_SetObject( app_exc_class.ptr(), bpl::incref( pyerr.ptr() ) );
+ bpl::object pimpl_err( err );
+ bpl::object pyerr_class = pimpl_err.attr( "py_err_class" );
+ bpl::object pyerr = pyerr_class( pimpl_err );
+ PyErr_SetObject( pyerr_class.ptr(), bpl::incref( pyerr.ptr() ) );
}
//Sometimes, exceptions should be passed back to the library.
Modified: pyplusplus_dev/docs/troubleshooting_guide/exceptions/test.py
===================================================================
--- pyplusplus_dev/docs/troubleshooting_guide/exceptions/test.py 2007-04-05 15:55:43 UTC (rev 970)
+++ pyplusplus_dev/docs/troubleshooting_guide/exceptions/test.py 2007-04-05 17:57:40 UTC (rev 971)
@@ -17,6 +17,7 @@
return super(application_error,self).__getattribute__(attr)
my_exceptions.application_error = application_error
+my_exceptions._application_error_.py_err_class = application_error
class tester_t( unittest.TestCase ):
def __init__( self, *args ):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|