INTEGRATION: CWS ooo11rc (1.2.4); FILE MERGED

2003/06/29 16:55:07 jbu 1.2.4.1: #i16215# fixed crash in case the python traceback object is null (occurs, when there is only a native code on the stack)
This commit is contained in:
Vladimir Glazounov 2003-07-02 14:18:38 +00:00
parent 07fa16315f
commit 3a64cd5133

View file

@ -2,9 +2,9 @@
*
* $RCSfile: pyuno_adapter.cxx,v $
*
* $Revision: 1.2 $
* $Revision: 1.3 $
*
* last change: $Author: jbu $ $Date: 2003-04-06 17:10:40 $
* last change: $Author: vg $ $Date: 2003-07-02 15:18:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -129,21 +129,32 @@ void raiseInvocationTargetExceptionWhenNeeded( const Runtime &runtime )
PyRef excType, excValue, excTraceback;
PyErr_Fetch( (PyObject **)&excType, (PyObject**)&excValue,(PyObject**)&excTraceback);
Any unoExc;
PyRef extractTraceback(
PyDict_GetItemString(
runtime.getImpl()->cargo->dictUnoModule.get(), "_uno_extract_printable_stacktrace" ) );
PyRef str;
if( extractTraceback.is() )
if( excTraceback.is() )
{
PyRef args( PyTuple_New( 1), SAL_NO_ACQUIRE );
PyTuple_SetItem( args.get(), 0, excTraceback.getAcquired() );
str = PyRef( PyObject_CallObject( extractTraceback.get(),args.get() ), SAL_NO_ACQUIRE);
PyRef extractTraceback(
PyDict_GetItemString(
runtime.getImpl()->cargo->dictUnoModule.get(),
"_uno_extract_printable_stacktrace" ) );
if( extractTraceback.is() )
{
PyRef args( PyTuple_New( 1), SAL_NO_ACQUIRE );
PyTuple_SetItem( args.get(), 0, excTraceback.getAcquired() );
str = PyRef( PyObject_CallObject( extractTraceback.get(),args.get() ), SAL_NO_ACQUIRE);
}
else
{
str = PyRef( PyString_FromString( "Couldn't find uno._uno_extract_printable_stacktrace" ),
SAL_NO_ACQUIRE );
}
}
else
{
str = PyRef( PyString_FromString( "Couldn't find uno._uno_extract_printable_stacktrace" ),
SAL_NO_ACQUIRE );
// it may occur, that no traceback is given (e.g. only native code below)
str = PyRef( PyString_FromString( "no traceback available" ), SAL_NO_ACQUIRE);
}
if( isInstanceOfStructOrException( runtime, excValue.get() ) )
{
unoExc = runtime.pyObject2Any( excValue );
@ -160,7 +171,6 @@ void raiseInvocationTargetExceptionWhenNeeded( const Runtime &runtime )
RuntimeException e;
e.Message = buf.makeStringAndClear();
unoExc = makeAny( e );
}
com::sun::star::uno::Exception e;
unoExc >>= e;