INTEGRATION: CWS pyunofixes2 (1.6.12); FILE MERGED

2006/01/07 21:36:51 jbu 1.6.12.3: RESYNC: (1.6-1.7); FILE MERGED
2005/09/09 18:51:58 jbu 1.6.12.2: #i54416# removed now obsolete PYUNO_DEBUG macro
2005/09/09 18:43:07 jbu 1.6.12.1: #i54416#,#i47270# added logging support for pyuno + refcounting bug for __members__ variable fixed
This commit is contained in:
Oliver Bolte
2006-03-22 09:48:37 +00:00
parent a69acc3c83
commit a48afb6fbf

View File

@@ -4,9 +4,9 @@
*
* $RCSfile: pyuno_adapter.cxx,v $
*
* $Revision: 1.7 $
* $Revision: 1.8 $
*
* last change: $Author: rt $ $Date: 2005-09-08 16:51:33 $
* last change: $Author: obo $ $Date: 2006-03-22 10:48:37 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -214,11 +214,20 @@ Any Adapter::invoke( const OUString &aFunctionName,
}
RuntimeCargo *cargo = 0;
try
{
PyThreadAttach guard( mInterpreter );
{
// convert parameters to python args
// TODO: Out parameter
Runtime runtime;
cargo = runtime.getImpl()->cargo;
if( isLog( cargo, LogLevel::CALL ) )
{
logCall( cargo, "try uno->py[0x",
(sal_Int64) mWrappedObject.get(), aFunctionName, aParams );
}
sal_Int32 size = aParams.getLength();
PyRef argsTuple(PyTuple_New( size ), SAL_NO_ACQUIRE );
@@ -251,9 +260,7 @@ Any Adapter::invoke( const OUString &aFunctionName,
throw IllegalArgumentException( buf.makeStringAndClear(), Reference< XInterface > (),0 );
}
PYUNO_DEBUG_2( "entering python method %s\n" , (char*)TO_ASCII(aFunctionName) );
PyRef pyRet( PyObject_CallObject( method.get(), argsTuple.get() ), SAL_NO_ACQUIRE );
PYUNO_DEBUG_3( "leaving python method %s %d\n" , (char*)TO_ASCII(aFunctionName) , pyRet.is() );
raiseInvocationTargetExceptionWhenNeeded( runtime);
if( pyRet.is() )
{
@@ -307,8 +314,57 @@ Any Adapter::invoke( const OUString &aFunctionName,
// else { sequence is a return value !}
}
}
// log the reply, if desired
if( isLog( cargo, LogLevel::CALL ) )
{
logReply( cargo, "success uno->py[0x" ,
(sal_Int64) mWrappedObject.get(), aFunctionName, ret, aOutParam );
}
}
}
catch(InvocationTargetException & e )
{
if( isLog( cargo, LogLevel::CALL ) )
{
logException(
cargo, "except uno->py[0x" ,
(sal_Int64) mWrappedObject.get(), aFunctionName,
e.TargetException.getValue(),e.TargetException.getValueType() );
}
throw;
}
catch( RuntimeException & e )
{
if( cargo && isLog( cargo, LogLevel::CALL ) )
{
logException(
cargo, "except uno->py[0x" ,
(sal_Int64) mWrappedObject.get(), aFunctionName, &e,getCppuType(&e) );
}
throw;
}
catch( CannotConvertException & e )
{
if( isLog( cargo, LogLevel::CALL ) )
{
logException(
cargo, "except uno->py[0x" ,
(sal_Int64) mWrappedObject.get(), aFunctionName, &e,getCppuType(&e) );
}
throw;
}
catch( IllegalArgumentException & e )
{
if( isLog( cargo, LogLevel::CALL ) )
{
logException(
cargo, "except uno->py[0x" ,
(sal_Int64) mWrappedObject.get(), aFunctionName, &e,getCppuType(&e) );
}
throw;
}
PYUNO_DEBUG_1( "leaving Adapter::invoke normally\n" );
return ret;
}