summaryrefslogtreecommitdiffstats
path: root/pyuno
diff options
context:
space:
mode:
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/CustomTarget_python_shell.mk6
-rw-r--r--pyuno/CustomTarget_pyuno_pythonloader_ini.mk2
-rw-r--r--pyuno/Package_python_shell.mk2
-rw-r--r--pyuno/Package_pyuno_pythonloader_ini.mk2
-rw-r--r--pyuno/PythonTest_pyuno_pytests_testofficehelper.mk13
-rw-r--r--pyuno/qa/pytests/testofficehelper.py50
-rw-r--r--pyuno/source/loader/pyuno_loader.cxx32
-rw-r--r--pyuno/source/module/pyuno.cxx16
-rw-r--r--pyuno/source/module/pyuno_adapter.cxx2
-rw-r--r--pyuno/source/module/pyuno_module.cxx29
-rw-r--r--pyuno/source/module/pyuno_runtime.cxx38
-rw-r--r--pyuno/source/module/pyuno_type.cxx8
12 files changed, 141 insertions, 59 deletions
diff --git a/pyuno/CustomTarget_python_shell.mk b/pyuno/CustomTarget_python_shell.mk
index 541620304d89..1a34501e59f2 100644
--- a/pyuno/CustomTarget_python_shell.mk
+++ b/pyuno/CustomTarget_python_shell.mk
@@ -20,15 +20,15 @@ else
pyuno_PYTHON_SHELL_VERSION:=$(PYTHON_VERSION)
endif
-$(call gb_CustomTarget_get_workdir,pyuno/python_shell)/python.sh : \
+$(gb_CustomTarget_workdir)/pyuno/python_shell/python.sh : \
$(SRCDIR)/pyuno/zipcore/python.sh \
- $(call gb_CustomTarget_get_workdir,pyuno/python_shell)/os.sh
+ $(gb_CustomTarget_workdir)/pyuno/python_shell/os.sh
$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CAT,1)
$(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),CAT)
cat $^ > $@ && chmod +x $@
$(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),CAT)
-$(call gb_CustomTarget_get_workdir,pyuno/python_shell)/os.sh : \
+$(gb_CustomTarget_workdir)/pyuno/python_shell/os.sh : \
$(SRCDIR)/pyuno/zipcore/$(if $(filter MACOSX,$(OS)),mac,nonmac).sh \
$(BUILDDIR)/config_$(gb_Side)/config_python.h
$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),SED,1)
diff --git a/pyuno/CustomTarget_pyuno_pythonloader_ini.mk b/pyuno/CustomTarget_pyuno_pythonloader_ini.mk
index cc5a67f3cadb..2db26d99f362 100644
--- a/pyuno/CustomTarget_pyuno_pythonloader_ini.mk
+++ b/pyuno/CustomTarget_pyuno_pythonloader_ini.mk
@@ -13,7 +13,7 @@ $(eval $(call gb_CustomTarget_register_targets,pyuno/pythonloader_ini, \
$(call gb_Helper_get_rcfile,pythonloader.uno) \
))
-$(call gb_CustomTarget_get_workdir,pyuno/pythonloader_ini)/$(call gb_Helper_get_rcfile,pythonloader.uno): \
+$(gb_CustomTarget_workdir)/pyuno/pythonloader_ini/$(call gb_Helper_get_rcfile,pythonloader.uno): \
$(BUILDDIR)/config_$(gb_Side)/config_python.h \
$(SRCDIR)/pyuno/CustomTarget_pyuno_pythonloader_ini.mk
$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,1)
diff --git a/pyuno/Package_python_shell.mk b/pyuno/Package_python_shell.mk
index f75cda39af31..0ecc42b886f7 100644
--- a/pyuno/Package_python_shell.mk
+++ b/pyuno/Package_python_shell.mk
@@ -7,7 +7,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
-$(eval $(call gb_Package_Package,python_shell,$(call gb_CustomTarget_get_workdir,pyuno/python_shell)))
+$(eval $(call gb_Package_Package,python_shell,$(gb_CustomTarget_workdir)/pyuno/python_shell))
ifeq ($(OS),MACOSX)
$(eval $(call gb_Package_add_file,python_shell,$(LIBO_ETC_FOLDER)/python,python.sh))
diff --git a/pyuno/Package_pyuno_pythonloader_ini.mk b/pyuno/Package_pyuno_pythonloader_ini.mk
index 0fae14618695..024f3635d89d 100644
--- a/pyuno/Package_pyuno_pythonloader_ini.mk
+++ b/pyuno/Package_pyuno_pythonloader_ini.mk
@@ -7,7 +7,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
-$(eval $(call gb_Package_Package,pyuno_pythonloader_ini,$(call gb_CustomTarget_get_workdir,pyuno/pythonloader_ini)))
+$(eval $(call gb_Package_Package,pyuno_pythonloader_ini,$(gb_CustomTarget_workdir)/pyuno/pythonloader_ini))
$(eval $(call gb_Package_add_files,pyuno_pythonloader_ini,$(LIBO_ETC_FOLDER), \
$(call gb_Helper_get_rcfile,pythonloader.uno) \
diff --git a/pyuno/PythonTest_pyuno_pytests_testofficehelper.mk b/pyuno/PythonTest_pyuno_pytests_testofficehelper.mk
new file mode 100644
index 000000000000..77aac9d0f00b
--- /dev/null
+++ b/pyuno/PythonTest_pyuno_pytests_testofficehelper.mk
@@ -0,0 +1,13 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+$(eval $(call gb_PythonTest_PythonTest,pyuno_pytests_testofficehelper))
+$(eval $(call gb_PythonTest_add_modules,pyuno_pytests_testofficehelper,$(SRCDIR)/pyuno/qa/pytests,\
+ testofficehelper \
+))
+# vim: set noet sw=4 ts=4: \ No newline at end of file
diff --git a/pyuno/qa/pytests/testofficehelper.py b/pyuno/qa/pytests/testofficehelper.py
new file mode 100644
index 000000000000..be2c99d8daf8
--- /dev/null
+++ b/pyuno/qa/pytests/testofficehelper.py
@@ -0,0 +1,50 @@
+import unittest
+from officehelper import bootstrap, BootstrapException
+
+
+class OfficeHelperTest(unittest.TestCase):
+ """officehelper.py must provide:
+ Support of Windows, Mac OS X & GNU/Linux distributions
+ Customizable connection with 'delays' **kwarg
+ Reporting to console with 'report' **kwarg
+ Memory cleanup from soffice service
+ extra features may be:
+ Python source documentation
+ """
+ def test_default_config(self):
+ # Check default timeout and number of attempts
+ # Stop LibreOffice running service
+ ctx = bootstrap() # Default settings suffice to initialize the service
+ #time.sleep(10) # gve
+ if ctx: # stop soffice as a service
+ smgr = ctx.getServiceManager()
+ desktop = smgr.createInstanceWithContext("com.sun.star.frame.Desktop", ctx)
+ desktop.terminate()
+ self.assertTrue(ctx) # check for failure
+
+ def test_kwargs(self):
+ # Wait differently for LO to start, request context 10 times
+ # Report processing in console
+ ctx = bootstrap(delays=[1,]*10, report=print)
+ if ctx: # stop soffice as a service
+ smgr = ctx.getServiceManager()
+ desktop = smgr.createInstanceWithContext("com.sun.star.frame.Desktop", ctx)
+ desktop.terminate()
+ self.assertTrue(ctx)
+
+ def test_exception(self):
+ # Raise BootstrapException and stop ALL PRESENT LibreOffice running services
+ with self.assertRaises(BootstrapException):
+ bootstrap(delays=[0,], report=print) # delays=[0,] must raise BootstrapException
+
+
+if __name__ == "__main__":
+
+ unittest.main()
+
+ # ~ dir(__name__)
+ # ~ help(__name__)
+ # ~ help(bootstrap)
+ # ~ exit()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab
diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx
index 008d58634947..3b5f5df7f531 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -97,7 +97,7 @@ static PyRef getLoaderModule()
raiseRuntimeExceptionWhenNeeded();
if( !module.is() )
{
- throw RuntimeException( "pythonloader: Couldn't load pythonloader module" );
+ throw RuntimeException( u"pythonloader: Couldn't load pythonloader module"_ustr );
}
return PyRef( PyModule_GetDict( module.get() ));
}
@@ -114,7 +114,11 @@ static PyRef getObjectFromLoaderModule( const char * func )
return object;
}
+#if PY_VERSION_HEX >= 0x03080000
+static void setPythonHome ( const OUString & pythonHome, PyConfig * config )
+#else
static void setPythonHome ( const OUString & pythonHome )
+#endif
{
OUString systemPythonHome;
osl_getSystemPathFromFileURL( pythonHome.pData, &(systemPythonHome.pData) );
@@ -138,9 +142,11 @@ static void setPythonHome ( const OUString & pythonHome )
PyErr_SetString(PyExc_SystemError, "python home path is too long");
return;
}
-SAL_WNODEPRECATED_DECLARATIONS_PUSH
- Py_SetPythonHome(wide); // deprecated since python 3.11
-SAL_WNODEPRECATED_DECLARATIONS_POP
+#if PY_VERSION_HEX >= 0x03080000
+ config->home = wide;
+#else
+ Py_SetPythonHome(wide);
+#endif
}
static void prependPythonPath( std::u16string_view pythonPathBootstrap )
@@ -181,7 +187,7 @@ static void prependPythonPath( std::u16string_view pythonPathBootstrap )
bufPYTHONPATH.append( OUString(oldEnv, strlen(oldEnv), osl_getThreadTextEncoding()) );
}
- OUString envVar("PYTHONPATH");
+ OUString envVar(u"PYTHONPATH"_ustr);
OUString envValue(bufPYTHONPATH.makeStringAndClear());
osl_setEnvironment(envVar.pData, envValue.pData);
}
@@ -192,20 +198,30 @@ void pythonInit() {
if ( Py_IsInitialized()) // may be inited by getComponentContext() already
return;
+#if PY_VERSION_HEX >= 0x03080000
+ PyConfig config;
+#endif
OUString pythonPath;
OUString pythonHome;
- OUString path( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("pythonloader.uno" ));
+ OUString path( u"$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("pythonloader.uno" ) ""_ustr);
rtl::Bootstrap::expandMacros(path); //TODO: detect failure
rtl::Bootstrap bootstrap(path);
+#if PY_VERSION_HEX >= 0x03080000
+ PyConfig_InitPythonConfig( &config );
+#endif
// look for pythonhome
- bootstrap.getFrom( "PYUNO_LOADER_PYTHONHOME", pythonHome );
- bootstrap.getFrom( "PYUNO_LOADER_PYTHONPATH", pythonPath );
+ bootstrap.getFrom( u"PYUNO_LOADER_PYTHONHOME"_ustr, pythonHome );
+ bootstrap.getFrom( u"PYUNO_LOADER_PYTHONPATH"_ustr, pythonPath );
// pythonhome+pythonpath must be set before Py_Initialize(), otherwise there appear warning on the console
// sadly, there is no api for setting the pythonpath, we have to use the environment variable
if( !pythonHome.isEmpty() )
+#if PY_VERSION_HEX >= 0x03080000
+ setPythonHome( pythonHome, &config );
+#else
setPythonHome( pythonHome );
+#endif
if( !pythonPath.isEmpty() )
prependPythonPath( pythonPath );
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 52e8b003fb18..af35283e6139 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -88,7 +88,7 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
{
assert( pVal );
if (pTypeRef->eTypeClass == typelib_TypeClass_VOID)
- return "void";
+ return u"void"_ustr;
OUStringBuffer buf( 64 );
buf.append( "(" + OUString::unacquired(&pTypeRef->pTypeName) + ")" );
@@ -559,10 +559,10 @@ static void lcl_getRowsColumns( PyUNO const * me, sal_Int32& nRows, sal_Int32& n
Sequence<short> aOutParamIndex;
Sequence<Any> aOutParam;
Sequence<Any> aParams;
- Any aRet = me->members->xInvocation->invoke ( "getRows", aParams, aOutParamIndex, aOutParam );
+ Any aRet = me->members->xInvocation->invoke ( u"getRows"_ustr, aParams, aOutParamIndex, aOutParam );
Reference< XIndexAccess > xIndexAccessRows( aRet, UNO_QUERY );
nRows = xIndexAccessRows->getCount();
- aRet = me->members->xInvocation->invoke ( "getColumns", aParams, aOutParamIndex, aOutParam );
+ aRet = me->members->xInvocation->invoke ( u"getColumns"_ustr, aParams, aOutParamIndex, aOutParam );
Reference< XIndexAccess > xIndexAccessCols( aRet, UNO_QUERY );
nColumns = xIndexAccessCols->getCount();
}
@@ -596,7 +596,7 @@ static PyObject* lcl_getitem_XCellRange( PyUNO const * me, PyObject* pKey )
{
PyThreadDetach antiguard;
aRet = me->members->xInvocation->invoke (
- "getCellRangeByName", aParams, aOutParamIndex, aOutParam );
+ u"getCellRangeByName"_ustr, aParams, aOutParamIndex, aOutParam );
}
PyRef rRet = runtime.any2PyObject ( aRet );
return rRet.getAcquired();
@@ -634,7 +634,7 @@ static PyObject* lcl_getitem_XCellRange( PyUNO const * me, PyObject* pKey )
{
PyThreadDetach antiguard;
aRet = me->members->xInvocation->invoke (
- "getCellByPosition", aParams, aOutParamIndex, aOutParam );
+ u"getCellByPosition"_ustr, aParams, aOutParamIndex, aOutParam );
}
PyRef rRet = runtime.any2PyObject( aRet );
return rRet.getAcquired();
@@ -657,7 +657,7 @@ static PyObject* lcl_getitem_XCellRange( PyUNO const * me, PyObject* pKey )
{
PyThreadDetach antiguard;
- if ( lcl_hasInterfaceByName( me->members->wrappedObject, "com.sun.star.table.XColumnRowRange" ) )
+ if ( lcl_hasInterfaceByName( me->members->wrappedObject, u"com.sun.star.table.XColumnRowRange"_ustr ) )
{
lcl_getRowsColumns (me, nLen0, nLen1);
}
@@ -680,7 +680,7 @@ static PyObject* lcl_getitem_XCellRange( PyUNO const * me, PyObject* pKey )
{
PyThreadDetach antiguard;
aRet = me->members->xInvocation->invoke (
- "getCellRangeByPosition", aParams, aOutParamIndex, aOutParam );
+ u"getCellRangeByPosition"_ustr, aParams, aOutParamIndex, aOutParam );
}
PyRef rRet = runtime.any2PyObject( aRet );
return rRet.getAcquired();
@@ -825,7 +825,7 @@ static PyObject* PyUNO_getitem( PyObject *self, PyObject *pKey )
{
PyThreadDetach antiguard;
- hasXCellRange = lcl_hasInterfaceByName( me->members->wrappedObject, "com.sun.star.table.XCellRange" );
+ hasXCellRange = lcl_hasInterfaceByName( me->members->wrappedObject, u"com.sun.star.table.XCellRange"_ustr );
}
if ( hasXCellRange )
{
diff --git a/pyuno/source/module/pyuno_adapter.cxx b/pyuno/source/module/pyuno_adapter.cxx
index 7ed527dfe3c0..a9502d34abd9 100644
--- a/pyuno/source/module/pyuno_adapter.cxx
+++ b/pyuno/source/module/pyuno_adapter.cxx
@@ -124,7 +124,7 @@ Sequence< sal_Int16 > Adapter::getOutIndexes( const OUString & functionName )
if( !introspection.is() )
{
throw RuntimeException(
- "pyuno bridge: Couldn't inspect uno adapter ( the python class must implement com.sun.star.lang.XTypeProvider !)" );
+ u"pyuno bridge: Couldn't inspect uno adapter ( the python class must implement com.sun.star.lang.XTypeProvider !)"_ustr );
}
Reference< XIdlMethod > method = introspection->getMethod(
diff --git a/pyuno/source/module/pyuno_module.cxx b/pyuno/source/module/pyuno_module.cxx
index fc0e9939506e..53527df35780 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -96,7 +96,7 @@ public:
, nPosConsumed (0)
{
if ( ! used )
- throw RuntimeException("pyuno._createUnoStructHelper failed to create new dictionary");
+ throw RuntimeException(u"pyuno._createUnoStructHelper failed to create new dictionary"_ustr);
}
~fillStructState()
{
@@ -196,21 +196,24 @@ void fillStruct(
}
}
-OUString getLibDir()
+OUString getLibDir();
+OUString getLibDirImpl()
{
- static OUString sLibDir = []() {
- OUString libDir;
+ OUString libDir;
- // workarounds the $(ORIGIN) until it is available
- if (Module::getUrlFromAddress(reinterpret_cast<oslGenericFunction>(getLibDir), libDir))
- {
- libDir = libDir.copy(0, libDir.lastIndexOf('/'));
- OUString name("PYUNOLIBDIR");
- rtl_bootstrap_set(name.pData, libDir.pData);
- }
- return libDir;
- }();
+ // workarounds the $(ORIGIN) until it is available
+ if (Module::getUrlFromAddress(reinterpret_cast<oslGenericFunction>(getLibDir), libDir))
+ {
+ libDir = libDir.copy(0, libDir.lastIndexOf('/'));
+ OUString name(u"PYUNOLIBDIR"_ustr);
+ rtl_bootstrap_set(name.pData, libDir.pData);
+ }
+ return libDir;
+}
+OUString getLibDir()
+{
+ static OUString sLibDir = getLibDirImpl();
return sLibDir;
}
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index 91e971fdd582..471121a8bf6d 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -155,21 +155,21 @@ static void getRuntimeImpl( PyRef & globalDict, PyRef &runtimeImpl )
PyThreadState * state = PyThreadState_Get();
if( ! state )
{
- throw RuntimeException( "python global interpreter must be held (thread must be attached)" );
+ throw RuntimeException( u"python global interpreter must be held (thread must be attached)"_ustr );
}
PyObject* pModule = PyImport_AddModule("__main__");
if (!pModule)
{
- throw RuntimeException("can't import __main__ module");
+ throw RuntimeException(u"can't import __main__ module"_ustr);
}
globalDict = PyRef( PyModule_GetDict(pModule));
if( ! globalDict.is() ) // FATAL !
{
- throw RuntimeException("can't find __main__ module");
+ throw RuntimeException(u"can't find __main__ module"_ustr);
}
runtimeImpl = PyDict_GetItemString( globalDict.get() , "pyuno_runtime" );
}
@@ -216,7 +216,7 @@ static void readLoggingConfig( sal_Int32 *pLevel, FILE **ppFile )
rtl::Bootstrap bootstrapHandle( fileName );
OUString str;
- if( bootstrapHandle.getFrom( "PYUNO_LOGLEVEL", str ) )
+ if( bootstrapHandle.getFrom( u"PYUNO_LOGLEVEL"_ustr, str ) )
{
if ( str == "NONE" )
*pLevel = LogLevel::NONE;
@@ -234,7 +234,7 @@ static void readLoggingConfig( sal_Int32 *pLevel, FILE **ppFile )
return;
*ppFile = stdout;
- if( !bootstrapHandle.getFrom( "PYUNO_LOGTARGET", str ) )
+ if( !bootstrapHandle.getFrom( u"PYUNO_LOGTARGET"_ustr, str ) )
return;
if ( str == "stdout" )
@@ -277,7 +277,7 @@ PyRef stRuntimeImpl::create( const Reference< XComponentContext > &ctx )
{
RuntimeImpl *me = PyObject_New (RuntimeImpl, &RuntimeImpl_Type);
if( ! me )
- throw RuntimeException( "cannot instantiate pyuno::RuntimeImpl" );
+ throw RuntimeException( u"cannot instantiate pyuno::RuntimeImpl"_ustr );
me->cargo = nullptr;
// must use a different struct here, as the PyObject_New
// makes C++ unusable
@@ -289,13 +289,13 @@ PyRef stRuntimeImpl::create( const Reference< XComponentContext > &ctx )
c->xContext = ctx;
c->xInvocation = Reference< XSingleServiceFactory > (
ctx->getServiceManager()->createInstanceWithContext(
- "com.sun.star.script.Invocation",
+ u"com.sun.star.script.Invocation"_ustr,
ctx ),
css::uno::UNO_QUERY_THROW );
c->xTypeConverter = Converter::create(ctx);
if( ! c->xTypeConverter.is() )
- throw RuntimeException( "pyuno: couldn't instantiate typeconverter service" );
+ throw RuntimeException( u"pyuno: couldn't instantiate typeconverter service"_ustr );
c->xCoreReflection = theCoreReflection::get(ctx);
@@ -303,10 +303,10 @@ PyRef stRuntimeImpl::create( const Reference< XComponentContext > &ctx )
c->xIntrospection = theIntrospection::get(ctx);
- Any a = ctx->getValueByName("/singletons/com.sun.star.reflection.theTypeDescriptionManager");
+ Any a = ctx->getValueByName(u"/singletons/com.sun.star.reflection.theTypeDescriptionManager"_ustr);
a >>= c->xTdMgr;
if( ! c->xTdMgr.is() )
- throw RuntimeException( "pyuno: couldn't retrieve typedescriptionmanager" );
+ throw RuntimeException( u"pyuno: couldn't retrieve typedescriptionmanager"_ustr );
me->cargo =c;
return PyRef( reinterpret_cast< PyObject * > ( me ), SAL_NO_ACQUIRE );
@@ -330,7 +330,7 @@ void Runtime::initialize( const Reference< XComponentContext > & ctx )
if( runtime.is() && impl->cargo->valid )
{
- throw RuntimeException("pyuno runtime has already been initialized before" );
+ throw RuntimeException(u"pyuno runtime has already been initialized before"_ustr );
}
PyRef keep( RuntimeImpl::create( ctx ) );
PyDict_SetItemString( globalDict.get(), "pyuno_runtime" , keep.get() );
@@ -354,8 +354,8 @@ Runtime::Runtime()
if( ! runtime.is() )
{
throw RuntimeException(
- "pyuno runtime is not initialized, "
- "(the pyuno.bootstrap needs to be called before using any uno classes)" );
+ u"pyuno runtime is not initialized, "
+ "(the pyuno.bootstrap needs to be called before using any uno classes)"_ustr );
}
impl = reinterpret_cast< RuntimeImpl * > (runtime.get());
Py_XINCREF( runtime.get() );
@@ -385,7 +385,7 @@ PyRef Runtime::any2PyObject (const Any &a ) const
{
if( ! impl->cargo->valid )
{
- throw RuntimeException("pyuno runtime must be initialized before calling any2PyObject" );
+ throw RuntimeException(u"pyuno runtime must be initialized before calling any2PyObject"_ustr );
}
switch (a.getValueTypeClass ())
@@ -650,7 +650,7 @@ Any Runtime::pyObject2Any(const PyRef & source, enum ConversionMode mode) const
{
if (!impl || !impl->cargo->valid)
{
- throw RuntimeException("pyuno runtime must be initialized before calling any2PyObject" );
+ throw RuntimeException(u"pyuno runtime must be initialized before calling any2PyObject"_ustr );
}
Any a;
@@ -758,7 +758,7 @@ Any Runtime::pyObject2Any(const PyRef & source, enum ConversionMode mode) const
if( !holder.is( ) )
{
throw RuntimeException(
- "struct or exception wrapper does not support XMaterialHolder" );
+ u"struct or exception wrapper does not support XMaterialHolder"_ustr );
}
a = holder->getMaterial();
@@ -784,8 +784,8 @@ Any Runtime::pyObject2Any(const PyRef & source, enum ConversionMode mode) const
if( ACCEPT_UNO_ANY != mode )
{
throw RuntimeException(
- "uno.Any instance not accepted during method call, "
- "use uno.invoke instead" );
+ u"uno.Any instance not accepted during method call, "
+ "use uno.invoke instead"_ustr );
}
a = pyObject2Any( PyRef( PyObject_GetAttrString( o , "value" ), SAL_NO_ACQUIRE) );
@@ -967,7 +967,7 @@ PyThreadAttach::PyThreadAttach( PyInterpreterState *interp)
tstate = PyThreadState_New( interp );
}
if( !tstate )
- throw RuntimeException( "Couldn't create a pythreadstate" );
+ throw RuntimeException( u"Couldn't create a pythreadstate"_ustr );
PyEval_AcquireThread( tstate);
}
diff --git a/pyuno/source/module/pyuno_type.cxx b/pyuno/source/module/pyuno_type.cxx
index a04b4e26d78c..ee44b466e519 100644
--- a/pyuno/source/module/pyuno_type.cxx
+++ b/pyuno/source/module/pyuno_type.cxx
@@ -129,13 +129,13 @@ sal_Unicode PyChar2Unicode( PyObject *obj )
if( ! PyUnicode_Check( value.get() ) )
{
throw RuntimeException(
- "attribute value of uno.Char is not a unicode string" );
+ u"attribute value of uno.Char is not a unicode string"_ustr );
}
if( PyUnicode_GetLength( value.get() ) < 1 )
{
throw RuntimeException(
- "uno.Char contains an empty unicode string");
+ u"uno.Char contains an empty unicode string"_ustr);
}
sal_Unicode c = static_cast<sal_Unicode>(PyUnicode_ReadChar( value.get(), 0));
@@ -150,7 +150,7 @@ Any PyEnum2Enum( PyObject *obj )
if( !PyUnicode_Check( typeName.get() ) || ! PyUnicode_Check( value.get() ) )
{
throw RuntimeException(
- "attributes typeName and/or value of uno.Enum are not strings" );
+ u"attributes typeName and/or value of uno.Enum are not strings"_ustr );
}
OUString strTypeName( OUString::createFromAscii( PyUnicode_AsUTF8( typeName.get() ) ) );
@@ -198,7 +198,7 @@ Type PyType2Type( PyObject * o )
if( !PyUnicode_Check( pyName.get() ) )
{
throw RuntimeException(
- "type object does not have typeName property" );
+ u"type object does not have typeName property"_ustr );
}
PyRef pyTC( PyObject_GetAttrString( o, "typeClass" ), SAL_NO_ACQUIRE );