[Libreoffice-commits] core.git: pyuno/source

2023-11-19 Thread Stephan Bergmann (via logerrit)
 pyuno/source/module/pyuno_module.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 115e7a00c3ab2927b10e569e41d60230cba93dec
Author: Stephan Bergmann 
AuthorDate: Sun Nov 19 17:32:21 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Sun Nov 19 20:39:16 2023 +0100

Extended loplugin:ostr: pyuno

Change-Id: Ie8ec1e8b3debd1501b16d40567a063390749a19b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159683
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/source/module/pyuno_module.cxx 
b/pyuno/source/module/pyuno_module.cxx
index d91b608b6671..793aac834b1b 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -561,7 +561,7 @@ static PyObject *checkType( SAL_UNUSED_PARAMETER PyObject 
*, PyObject *args )
 {
 if( !PyTuple_Check( args ) || PyTuple_Size( args) != 1 )
 {
-OString buf = "pyuno.checkType : expecting one uno.Type argument";
+OString buf = "pyuno.checkType : expecting one uno.Type argument"_ostr;
 PyErr_SetString( PyExc_RuntimeError, buf.getStr() );
 return nullptr;
 }
@@ -584,7 +584,7 @@ static PyObject *checkEnum( SAL_UNUSED_PARAMETER PyObject 
*, PyObject *args )
 {
 if( !PyTuple_Check( args ) || PyTuple_Size( args) != 1 )
 {
-OString buf = "pyuno.checkType : expecting one uno.Type argument";
+OString buf = "pyuno.checkType : expecting one uno.Type argument"_ostr;
 PyErr_SetString( PyExc_RuntimeError, buf.getStr() );
 return nullptr;
 }
@@ -764,7 +764,7 @@ static PyObject * invoke(SAL_UNUSED_PARAMETER PyObject *, 
PyObject *args)
 }
 else
 {
-OString buf = "uno.invoke expects object, name, (arg1, arg2, ... )\n";
+OString buf = "uno.invoke expects object, name, (arg1, arg2, ... 
)\n"_ostr;
 PyErr_SetString(PyExc_RuntimeError, buf.getStr());
 }
 return ret;
@@ -816,7 +816,7 @@ static PyObject *setCurrentContext(
 }
 else
 {
-OString buf = "uno.setCurrentContext expects exactly one argument 
(the current Context)\n";
+OString buf = "uno.setCurrentContext expects exactly one argument 
(the current Context)\n"_ostr;
 PyErr_SetString(
 PyExc_RuntimeError, buf.getStr() );
 }


[Libreoffice-commits] core.git: pyuno/source

2023-04-17 Thread Stephan Bergmann (via logerrit)
 pyuno/source/loader/pyuno_loader.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 1c8df0fd1ad896cbf7dfb08f2d70fa49e70c5106
Author: Stephan Bergmann 
AuthorDate: Mon Apr 17 09:20:20 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Apr 17 11:42:07 2023 +0200

loplugin:stringadd

Change-Id: I04dad33cad121eba7189fc78cac762e31d7c4c2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150477
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/source/loader/pyuno_loader.cxx 
b/pyuno/source/loader/pyuno_loader.cxx
index e9cbc807ebf3..27ef6abbc198 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -208,9 +208,7 @@ void pythonInit() {
 OUString sBrandLocation("$BRAND_BASE_DIR/program");
 rtl::Bootstrap::expandMacros(sBrandLocation);
 osl::FileBase::getSystemPathFromFileURL(sBrandLocation, sBrandLocation);
-sPath = OUStringBuffer(sPath).
-append(static_cast(SAL_PATHSEPARATOR)).
-append(sBrandLocation).makeStringAndClear();
+sPath = sPath + OUStringChar(SAL_PATHSEPARATOR) + sBrandLocation;
 osl_setEnvironment(sEnvName.pData, sPath.pData);
 #endif
 


[Libreoffice-commits] core.git: pyuno/source registry/inc

2023-02-13 Thread buldi (via logerrit)
 pyuno/source/module/pyuno_impl.hxx |5 +
 registry/inc/regapi.hxx|5 +
 2 files changed, 2 insertions(+), 8 deletions(-)

New commits:
commit 8ca611b2125a74cfdb273cfedfa3b94de14f628b
Author: buldi 
AuthorDate: Thu Feb 9 22:53:12 2023 +0100
Commit: Julien Nabet 
CommitDate: Mon Feb 13 11:26:27 2023 +

tdf#143148 Use pragma once instead of include guards

Change-Id: I5a88b699425a37b914a71400e918965a9f6116eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146730
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/pyuno/source/module/pyuno_impl.hxx 
b/pyuno/source/module/pyuno_impl.hxx
index 90e94af07401..946991c3864b 100644
--- a/pyuno/source/module/pyuno_impl.hxx
+++ b/pyuno/source/module/pyuno_impl.hxx
@@ -16,8 +16,7 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#ifndef INCLUDED_PYUNO_SOURCE_MODULE_PYUNO_IMPL_HXX
-#define INCLUDED_PYUNO_SOURCE_MODULE_PYUNO_IMPL_HXX
+#pragma once
 
 #if defined(_MSC_VER)
 // Workaround for some horrible hypot() mess
@@ -300,6 +299,4 @@ void decreaseRefCount( PyInterpreterState *interpreter, 
PyObject *object );
 
 }
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/registry/inc/regapi.hxx b/registry/inc/regapi.hxx
index ae5b7e119e48..6d1ed00f532a 100644
--- a/registry/inc/regapi.hxx
+++ b/registry/inc/regapi.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_REGISTRY_INC_REGAPI_HXX
-#define INCLUDED_REGISTRY_INC_REGAPI_HXX
+#pragma once
 
 #include 
 #include 
@@ -85,6 +84,4 @@ REG_DLLPUBLIC RegError REGISTRY_CALLTYPE 
reg_closeRegistry(RegHandle hRegistry);
 */
 REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_dumpRegistry(RegKeyHandle hKey);
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: pyuno/source

2022-09-16 Thread Mike Kaganski (via logerrit)
 pyuno/source/loader/pythonloader.py |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 2875d11939679ec319e5b098a9b85da629781d5c
Author: Mike Kaganski 
AuthorDate: Fri Sep 16 10:53:21 2022 +0300
Commit: Mike Kaganski 
CommitDate: Fri Sep 16 12:55:06 2022 +0200

tdf#150982: properly unquote (URL-decode) vnd.sun.star.expand payload

Similar to what is done in bootstrap_expandUri, expandUnoRcUrl,
UrlReference::expand, JavaLoader.expand_url, and is documented
in XVndSunStarExpandUrl interface.

Change-Id: I92917adb38e42c3926494427e4df2451298033e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140042
Reviewed-by: Stephan Bergmann 
Tested-by: Mike Kaganski 

diff --git a/pyuno/source/loader/pythonloader.py 
b/pyuno/source/loader/pythonloader.py
index 9a7114aea210..02f901942cbb 100644
--- a/pyuno/source/loader/pythonloader.py
+++ b/pyuno/source/loader/pythonloader.py
@@ -21,6 +21,7 @@ import unohelper
 import sys
 import types
 import os
+from urllib.parse import unquote
 from com.sun.star.uno import Exception,RuntimeException
 from com.sun.star.loader import XImplementationLoader
 from com.sun.star.lang import XServiceInfo
@@ -68,7 +69,7 @@ class Loader( XImplementationLoader, XServiceInfo, 
unohelper.Base ):
 protocol, dependent = splitUrl( url )
 if "vnd.sun.star.expand" == protocol:
 exp = self.ctx.getValueByName( 
"/singletons/com.sun.star.util.theMacroExpander" )
-url = exp.expandMacros(dependent)
+url = exp.expandMacros(unquote(dependent))
 protocol,dependent = splitUrl( url )
 
 if DEBUG:


[Libreoffice-commits] core.git: pyuno/source

2022-08-09 Thread Niko Fink (via logerrit)
 pyuno/source/module/uno.py |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 1052ec9cff72e2810fdb934a85ab500d3b4ace35
Author: Niko Fink 
AuthorDate: Tue Aug 9 09:17:00 2022 +0200
Commit: Michael Stahl 
CommitDate: Tue Aug 9 11:55:38 2022 +0200

tdf#133123: fix crash when importing defusedxml.ElementTree after pyuno

Change-Id: I89ac6108c679504c81dd9a439a4fb02e9e1adc07
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138007
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/pyuno/source/module/uno.py b/pyuno/source/module/uno.py
index 5fa7b135736d..b2a75bd03982 100644
--- a/pyuno/source/module/uno.py
+++ b/pyuno/source/module/uno.py
@@ -365,6 +365,8 @@ def _uno_import(name, *optargs, **kwargs):
 else:
 # How to create a module ??
 mod = pyuno.__class__(module)
+if mod is None:
+raise py_import_exc
 
 d = mod.__dict__
 


[Libreoffice-commits] core.git: pyuno/source

2022-06-16 Thread Stephan Bergmann (via logerrit)
 pyuno/source/loader/pyuno_loader.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 1638b4f78af70b7b97d0a081ed51390dd87bf1f9
Author: Stephan Bergmann 
AuthorDate: Thu Jun 16 18:58:18 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Jun 16 22:40:28 2022 +0200

rhbz#2097411 Avoid obsolete PyThreadState_Delete crashing Python 3.11

1fb53a637597f76bea86514b62ddfad34f60c889 "pyuno_loader::CreateInstance: 
delete
the initial PyThreadState" had added the PyThreadState_Delete for claimed
benefits but whose details appear lost to history (cf. the comment thread
starting at


"pyuno_loader::CreateInstance: delete the initial PyThreadState").  And at 
least
a recent master Linux --enable-python=fully-internal build with the bundled
Python 3.8.12 appears to succeed `make check` just fine with the
PyThreadState_Delete temporarily removed.

But on the other hand, building against upcoming Python 3.11 now started to 
make
CppunitTest_services fail with

> Fatal Python error: init_threadstate: thread state already initialized
> Python runtime state: initialized
> Thread 0x81c8b020 (most recent call first):
>   
> Fatal exception: Signal 6
> Stack:
> 
/builddir/build/BUILD/libreoffice-7.3.4.2/instdir/program/libuno_sal.so.3(+0x37c28)[0x81be7c28]
> 
/builddir/build/BUILD/libreoffice-7.3.4.2/instdir/program/libuno_sal.so.3(+0x37e40)[0x81be7e40]
> linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0x81ccb7ec]
> /lib64/libc.so.6(+0x82878)[0x81742878]
> /lib64/libc.so.6(raise+0x20)[0x816fae00]
> /lib64/libc.so.6(abort+0xe8)[0x816e72b8]
> /lib64/libpython3.11.so.1.0(+0x104e28)[0xfffee4de4e28]
> /lib64/libpython3.11.so.1.0(+0x105200)[0xfffee4de5200]
> 
/lib64/libpython3.11.so.1.0(PyThread_get_thread_native_id+0x0)[0xfffee4ed6764]
> /lib64/libpython3.11.so.1.0(PyThreadState_New+0x14)[0xfffee4ed6628]
> 
/builddir/build/BUILD/libreoffice-7.3.4.2/instdir/program/libpyuno.so(_ZN5pyuno14PyThreadAttachC2EP3_is+0x78)[0xfffee4c8c52c]
> 
/builddir/build/BUILD/libreoffice-7.3.4.2/instdir/program/libpythonloaderlo.so(pyuno_Loader_get_implementation+0x5c)[0xfffee5243060]
> 
/builddir/build/BUILD/libreoffice-7.3.4.2/instdir/program/libuno_cppuhelpergcc3.so.3(+0x544b4)[0x815544b4]

because of the PyThreadState_Delete.  (The deleted PyThreadState, while not
reused again directly, is still recorded in the state obtained from
PyInterpreterState_Head() later.)

So conservatively keep the PyThreadState_Delete of unclear benefit for older
Python versions and only drop it for 3.11 where it is known to have negative
effects now.

Change-Id: I9b99f1e947f0b165ddc95c2bfbd764858dda39db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136006
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/source/loader/pyuno_loader.cxx 
b/pyuno/source/loader/pyuno_loader.cxx
index c9b8248c1b25..da0467f450c6 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -229,10 +229,12 @@ void pythonInit() {
 
 PyThreadState *tstate = PyThreadState_Get();
 PyEval_ReleaseThread( tstate );
+#if PY_VERSION_HEX < 0x030B
 // This tstate is never used again, so delete it here.
 // This prevents an assertion in PyThreadState_Swap on the
 // PyThreadAttach below.
 PyThreadState_Delete(tstate);
+#endif
 }
 
 }


[Libreoffice-commits] core.git: pyuno/source

2022-05-04 Thread Stephan Bergmann (via logerrit)
 pyuno/source/loader/pyuno_loader.cxx   |2 -
 pyuno/source/module/pyuno.cxx  |   61 -
 pyuno/source/module/pyuno_adapter.cxx  |5 +-
 pyuno/source/module/pyuno_callable.cxx |6 +--
 pyuno/source/module/pyuno_iterator.cxx |   18 -
 pyuno/source/module/pyuno_module.cxx   |   39 ++---
 pyuno/source/module/pyuno_struct.cxx   |   19 --
 7 files changed, 73 insertions(+), 77 deletions(-)

New commits:
commit 51c986230316643e42a3deff7e802a8455fd0459
Author: Stephan Bergmann 
AuthorDate: Wed May 4 07:02:00 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed May 4 08:41:43 2022 +0200

Just use Any ctor instead of makeAny in pyuno

Change-Id: I53eb836c64e8e4a354c5c895bc7f16b168bd4cf3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133793
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/source/loader/pyuno_loader.cxx 
b/pyuno/source/loader/pyuno_loader.cxx
index f01d8a0529a3..c9b8248c1b25 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -259,7 +259,7 @@ pyuno_Loader_get_implementation(
 Runtime runtime;
 
 PyRef pyCtx = runtime.any2PyObject(
-css::uno::makeAny( css::uno::Reference(ctx) ) );
+css::uno::Any( css::uno::Reference(ctx) ) );
 
 PyRef clazz = getObjectFromLoaderModule( "Loader" );
 PyRef args ( PyTuple_New( 1 ), SAL_NO_ACQUIRE, NOT_NULL );
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 0db385793d86..cc4858279949 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -48,7 +48,6 @@ using com::sun::star::uno::Sequence;
 using com::sun::star::uno::Reference;
 using com::sun::star::uno::XInterface;
 using com::sun::star::uno::Any;
-using com::sun::star::uno::makeAny;
 using com::sun::star::uno::UNO_QUERY;
 using com::sun::star::uno::Type;
 using com::sun::star::uno::TypeClass;
@@ -428,19 +427,19 @@ PyObject *PyUNO_invoke( PyObject *object, const char 
*name , PyObject *args )
 }
 catch (const css::lang::IllegalArgumentException )
 {
-raisePyExceptionWithAny( css::uno::makeAny( e ) );
+raisePyExceptionWithAny( css::uno::Any( e ) );
 }
 catch (const css::script::CannotConvertException )
 {
-raisePyExceptionWithAny( css::uno::makeAny( e ) );
+raisePyExceptionWithAny( css::uno::Any( e ) );
 }
 catch (const css::uno::RuntimeException )
 {
-raisePyExceptionWithAny( css::uno::makeAny( e ) );
+raisePyExceptionWithAny( css::uno::Any( e ) );
 }
 catch (const css::uno::Exception )
 {
-raisePyExceptionWithAny( css::uno::makeAny( e ) );
+raisePyExceptionWithAny( css::uno::Any( e ) );
 }
 
 return ret.getAcquired();
@@ -482,7 +481,7 @@ static PyObject* PyUNO_dir (PyObject* self)
 }
 catch( const RuntimeException  )
 {
-raisePyExceptionWithAny( makeAny(e) );
+raisePyExceptionWithAny( Any(e) );
 }
 
 return member_list;
@@ -529,7 +528,7 @@ static int PyUNO_bool( PyObject* self )
 }
 catch( const css::uno::RuntimeException  )
 {
-raisePyExceptionWithAny( css::uno::makeAny( e ) );
+raisePyExceptionWithAny( css::uno::Any( e ) );
 }
 
 return -1;
@@ -549,7 +548,7 @@ static Py_ssize_t PyUNO_len( PyObject* self )
 }
 catch( const css::uno::RuntimeException  )
 {
-raisePyExceptionWithAny( css::uno::makeAny( e ) );
+raisePyExceptionWithAny( css::uno::Any( e ) );
 }
 
 return -1;
@@ -857,19 +856,19 @@ static PyObject* PyUNO_getitem( PyObject *self, PyObject 
*pKey )
 }
 catch( const css::script::CannotConvertException  )
 {
-raisePyExceptionWithAny( css::uno::makeAny( e ) );
+raisePyExceptionWithAny( css::uno::Any( e ) );
 }
 catch( const css::lang::IllegalArgumentException  )
 {
-raisePyExceptionWithAny( css::uno::makeAny( e ) );
+raisePyExceptionWithAny( css::uno::Any( e ) );
 }
 catch( const css::lang::WrappedTargetException  )
 {
-raisePyExceptionWithAny( css::uno::makeAny( e ) );
+raisePyExceptionWithAny( css::uno::Any( e ) );
 }
 catch( const css::uno::RuntimeException  )
 {
-raisePyExceptionWithAny( css::uno::makeAny( e ) );
+raisePyExceptionWithAny( css::uno::Any( e ) );
 }
 
 return nullptr;
@@ -1172,15 +1171,15 @@ static int PyUNO_setitem( PyObject *self, PyObject 
*pKey, PyObject *pValue )
 }
 catch( const css::container::ElementExistException  )
 {
-raisePyExceptionWithAny( css::uno::makeAny( e ) );
+raisePyExceptionWithAny( css::uno::Any( e ) );
 }
 catch( const css::lang::WrappedTargetException  )
 {
-raisePyExceptionWithAny( css::uno::makeAny( e ) );
+raisePyExceptionWithAny( css::uno::Any( e ) );
 }
 catch( const 

[Libreoffice-commits] core.git: pyuno/source

2022-04-01 Thread Stephan Bergmann (via logerrit)
 pyuno/source/module/pyuno.cxx |   20 +++-
 1 file changed, 15 insertions(+), 5 deletions(-)

New commits:
commit b3b18ed165b7bab80e15f130fe7826595460539c
Author: Stephan Bergmann 
AuthorDate: Fri Apr 1 14:27:52 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Apr 1 16:56:58 2022 +0200

Don't make UNO calls from PyThreadAttached regions (i.e., with the GIL 
locked)

...which caused e.g. UITest_writer_tests3 to occasionally hang with the
python.bin process thread 1 at

>   File "sw/qa/uitest/writer_tests3/insertPageFooter.py", line 30, in 
delete_footer
[...]

i.e.,

> #4  ___pthread_cond_wait at 
/usr/src/debug/glibc-2.35-4.fc36.x86_64/nptl/pthread_cond_wait.c:618
> #5  0x7ff9d6ad9c43 in cppu_threadpool::JobQueue::enter(void const*, 
bool) at cppu/source/threadpool/jobqueue.cxx:72
> #6  0x7ff9d6ae8e79 in 
cppu_threadpool::ThreadPool::enter(rtl::ByteSequence const&, void const*) at 
cppu/source/threadpool/threadpool.cxx:303
> #7  0x7ff9d6ae9278 in uno_threadpool_enter(uno_ThreadPool, void**) at 
cppu/source/threadpool/threadpool.cxx:407
> #8  0x7ff9c7d016eb in binaryurp::Bridge::makeCall(rtl::OUString 
const&, com::sun::star::uno::TypeDescription const&, bool, 
std::__debug::vector 
>&&, binaryurp::BinaryAny*, std::__debug::vector >*) at binaryurp/source/bridge.cxx:604
> #9  0x7ff9c7d322fc in 
binaryurp::Proxy::do_dispatch_throw(_typelib_TypeDescription const*, void*, 
void**, _uno_Any**) const at binaryurp/source/proxy.cxx:168
> #10 0x7ff9c7d338cb in 
binaryurp::Proxy::do_dispatch(_typelib_TypeDescription const*, void*, void**, 
_uno_Any**) const at binaryurp/source/proxy.cxx:101
> #11 0x7ff9d63222e0 in 
cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy*, 
typelib_TypeDescription const*, typelib_TypeDescriptionReference*, sal_Int32, 
typelib_MethodParameter*, void**, void**, void**, sal_uInt64*) at 
bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx:191
> #12 0x7ff9d6322b59 in cpp_vtable_call(sal_Int32, sal_Int32, void**, 
void**, void**, sal_uInt64*) at 
bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx:389
> #13 0x7ff9d63336ca in privateSnippetExecutor at 
instdir/program/libgcc3_uno.so
> #14 0x7ff9d6241f38 in (anonymous 
namespace)::ImplIntrospectionAccess::hasByName(rtl::OUString const&) at 
stoc/source/inspect/introspection.cxx:1114
> #15 0x7ff9d6b856b2 in pyuno::PyUNO_getattr(PyObject*, char*) at 
pyuno/source/module/pyuno.cxx:1392
[...]

doing a remote call to soffice.bin with GIL locked, and thread 4 at

> #6  0x7ff9e51efa28 in take_gil at 
workdir/UnpackedTarball/python3/Python/ceval_gil.h:207
> #7  0x7ff9e51f00d3 in PyEval_AcquireThread at 
workdir/UnpackedTarball/python3/Python/ceval.c:316
> #8  0x7ff9d6b9b1e8 in pyuno::Adapter::invoke(rtl::OUString const&, 
com::sun::star::uno::Sequence const&, 
com::sun::star::uno::Sequence&, 
com::sun::star::uno::Sequence&) at 
pyuno/source/module/pyuno_adapter.cxx:181
> #9  0x7ff9d632b3e4 in gcc3::callVirtualMethod(void*, unsigned int, 
void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, 
unsigned long*, double*) at 
bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:77
> #10 0x7ff9d632a4f1 in 
cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, 
bridges::cpp_uno::shared::VtableSlot, typelib_TypeDescriptionReference*, 
sal_Int32, typelib_MethodParameter*, void*, void**, uno_Any**) at 
bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:233
> #11 0x7ff9d632a9e6 in 
bridges::cpp_uno::shared::unoInterfaceProxyDispatch(uno_Interface*, 
typelib_TypeDescription const*, void*, void**, uno_Any**) at 
bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413
> #12 0x7ff9d621384a in stoc_invadp::(anonymous 
namespace)::AdapterImpl::invoke at 
stoc/source/invocation_adapterfactory/iafactory.cxx:457
> #13 stoc_invadp::adapter_dispatch(uno_Interface*, typelib_TypeDescription 
const*, void*, void**, uno_Any**) at 
stoc/source/invocation_adapterfactory/iafactory.cxx:605
> #14 0x7ff9c7d1a7db in 
binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, 
std::__debug::vector 
>*) const at include/typelib/typedescription.hxx:155
> #15 0x7ff9c7d1d65f in binaryurp::IncomingRequest::execute() const at 
binaryurp/source/incomingrequest.cxx:78
> #16 0x7ff9c7d33ad3 in binaryurp::(anonymous 
namespace)::request(void*) at 
~/gcc/trunk/inst/include/c++/12.0.1/bits/unique_ptr.h:172
> #17 0x7ff9d6ad9e1b in cppu_threadpool::JobQueue::enter(void const*, 
bool) at cppu/source/threadpool/jobqueue.cxx:100
> #18 0x7ff9d6adbb80 in cppu_threadpool::ORequestThread::run() at 
cppu/source/threadpool/thread.cxx:164
[...]

processing an unrelated incoming call from soffice.bin and blocked trying to
lock the GIL.  (The reason that thread 1 doesn't make 

[Libreoffice-commits] core.git: pyuno/source

2022-01-07 Thread Mike Kaganski (via logerrit)
 pyuno/source/module/pyuno_gc.cxx |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 639419601a3730eb84d0922ef3a540c961b81910
Author: Mike Kaganski 
AuthorDate: Fri Jan 7 11:21:31 2022 +0300
Commit: Mike Kaganski 
CommitDate: Fri Jan 7 14:30:30 2022 +0100

tdf#146621: handle an exception that may hang process at ExitProcess time

Change-Id: I3ffc2303ae1851ab909612ae9bb7f70a077b24fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128097
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/pyuno/source/module/pyuno_gc.cxx b/pyuno/source/module/pyuno_gc.cxx
index e4ed6cb9d0a6..1efca400d510 100644
--- a/pyuno/source/module/pyuno_gc.cxx
+++ b/pyuno/source/module/pyuno_gc.cxx
@@ -111,11 +111,20 @@ void decreaseRefCount( PyInterpreterState *interpreter, 
PyObject *object )
 // to be a method, which tells, whether the global
 // interpreter lock is held or not
 // TODO: Look for a more efficient solution
-rtl::Reference< GCThread >(new GCThread(interpreter, object))->launch();
+try
+{
+rtl::Reference< GCThread >(new GCThread(interpreter, 
object))->launch();
 //TODO: a protocol is missing how to join with the launched thread
 // before exit(3), to ensure the thread is no longer relying on any
 // infrastructure while that infrastructure is being shut down in
 // atexit handlers
+}
+catch (std::runtime_error&)
+{
+// tdf#146621: Thread creation will fail on Windows with 
ERROR_ACCESS_DENIED
+// when called at ExitProcess time; unhandled exception would hang the 
process
+abort();
+}
 }
 
 }


[Libreoffice-commits] core.git: pyuno/source

2021-09-11 Thread Mike Kaganski (via logerrit)
 pyuno/source/module/pyuno_adapter.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit b733ccad171e6def8fbdb93f31875dfdea47bdc6
Author: Mike Kaganski 
AuthorDate: Sat Sep 11 19:31:20 2021 +0200
Commit: Mike Kaganski 
CommitDate: Sun Sep 12 00:41:12 2021 +0200

Make this instance of cppu::OImplementationId function-local

Change-Id: I1feaaec9906fd06ae86226c35820072d8b19cf17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121891
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/pyuno/source/module/pyuno_adapter.cxx 
b/pyuno/source/module/pyuno_adapter.cxx
index a8efd4153831..53e012a8e78f 100644
--- a/pyuno/source/module/pyuno_adapter.cxx
+++ b/pyuno/source/module/pyuno_adapter.cxx
@@ -27,6 +27,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -66,16 +67,15 @@ Adapter::~Adapter()
 mWrappedObject.scratch();
 }
 
-static cppu::OImplementationId g_id( false );
-
 Sequence Adapter::getUnoTunnelId()
 {
+static const cppu::OImplementationId g_id(false);
 return g_id.getImplementationId();
 }
 
 sal_Int64 Adapter::getSomething( const Sequence< sal_Int8 > )
 {
-if( id == g_id.getImplementationId() )
+if (isUnoTunnelId(id))
 return reinterpret_cast(this);
 return 0;
 }


[Libreoffice-commits] core.git: pyuno/source

2021-03-22 Thread Caolán McNamara (via logerrit)
 pyuno/source/module/pyuno_runtime.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 962a9ce0a1ebe63f341fa27af8203991c44dd56f
Author: Caolán McNamara 
AuthorDate: Mon Mar 22 10:17:17 2021 +
Commit: Caolán McNamara 
CommitDate: Mon Mar 22 13:15:08 2021 +0100

cid#1473905 Dereference after null check

Change-Id: I949971374a68156ba78dce3b8d058774b1bef816
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112872
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index 91caaffb457c..10257a8ef69e 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -638,9 +638,9 @@ bool Runtime::pyIterUnpack( PyObject *const pObj, Any  ) 
const
 return true;
 }
 
-Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) 
const
+Any Runtime::pyObject2Any(const PyRef & source, enum ConversionMode mode) const
 {
-if( ! impl->cargo->valid )
+if (!impl || !impl->cargo->valid)
 {
 throw RuntimeException("pyuno runtime must be initialized before 
calling any2PyObject" );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2021-02-05 Thread dante (via logerrit)
 pyuno/source/module/pyuno_type.cxx |9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

New commits:
commit 476caeed6e14b3f1cda9435d3fbfa89df0457924
Author: dante 
AuthorDate: Wed Feb 3 12:50:37 2021 +0100
Commit: Michael Stahl 
CommitDate: Fri Feb 5 11:44:52 2021 +0100

tdf#138987 Python 3.12 preparations

Change-Id: I8ea476bfbaf27f8ab2daf4a370efc9917a5f9f8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110346
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/pyuno/source/module/pyuno_type.cxx 
b/pyuno/source/module/pyuno_type.cxx
index 7a919c9bde32..63176c3a2970 100644
--- a/pyuno/source/module/pyuno_type.cxx
+++ b/pyuno/source/module/pyuno_type.cxx
@@ -138,7 +138,7 @@ sal_Unicode PyChar2Unicode( PyObject *obj )
 "uno.Char contains an empty unicode string");
 }
 
-sal_Unicode c = static_cast(PyUnicode_AsUnicode( value.get() 
)[0]);
+sal_Unicode c = static_cast(PyUnicode_ReadChar( value.get(), 
0));
 return c;
 }
 
@@ -265,11 +265,8 @@ PyObject* PyUNO_char_new ( sal_Unicode val , const Runtime 
 )
 {
 // retrieve type object
 PyRef args( PyTuple_New( 1 ), SAL_NO_ACQUIRE, NOT_NULL );
-
-Py_UNICODE u[2];
-u[0] = val;
-u[1] = 0;
-PyTuple_SetItem( args.get() , 0 , PyUnicode_FromUnicode( u ,1) );
+static_assert(sizeof(sal_Unicode) == sizeof(Py_UCS2), "unexpected size");
+PyTuple_SetItem( args.get() , 0 , PyUnicode_FromKindAndData( 
PyUnicode_2BYTE_KIND,  ,1) );
 
 return callCtor( r, "Char" , args );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2021-01-05 Thread David Ostrovsky (via logerrit)
 pyuno/source/loader/pyuno_loader.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit c099288c232c864583b9a263069390a75bf43524
Author: David Ostrovsky 
AuthorDate: Mon Dec 21 07:56:11 2020 +0100
Commit: Michael Stahl 
CommitDate: Tue Jan 5 12:18:11 2021 +0100

tdf#138987 pyuno: PyEval_InitThreads is a no-op in Python 3.9

Change-Id: I220eecfa6aaf4d5cb12e3b4eacadf25843b41452
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108403
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/pyuno/source/loader/pyuno_loader.cxx 
b/pyuno/source/loader/pyuno_loader.cxx
index 3a7bfd5cf45f..0db6e637a2a7 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -223,7 +223,9 @@ void pythonInit() {
 
 // initialize python
 Py_Initialize();
+#if PY_VERSION_HEX < 0x0309
 PyEval_InitThreads();
+#endif
 
 PyThreadState *tstate = PyThreadState_Get();
 PyEval_ReleaseThread( tstate );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2021-01-04 Thread Stephan Bergmann (via logerrit)
 pyuno/source/loader/pyuno_loader.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ff3ce4f389083fba206e752e09f6b60ca003f625
Author: Stephan Bergmann 
AuthorDate: Mon Jan 4 10:59:58 2021 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Jan 4 18:25:41 2021 +0100

mbstowcs failure check is only relevant for non-_WIN32 now

...after cbe9a0a815e4a73bf8db425a7c5c651e67b2ed65 "Use Unicode paths on 
Windows
for pyuno"

Change-Id: I898ee8ebbc1dfb215c55940c6336756ae7b5ccc5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108658
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/source/loader/pyuno_loader.cxx 
b/pyuno/source/loader/pyuno_loader.cxx
index 1337ea8c78f9..3a7bfd5cf45f 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -119,12 +119,12 @@ static void setPythonHome ( const OUString & pythonHome )
 #else
 OString o = OUStringToOString(systemPythonHome, 
osl_getThreadTextEncoding());
 size_t len = mbstowcs(wide, o.pData->buffer, PATH_MAX + 1);
-#endif
 if(len == size_t(-1))
 {
 PyErr_SetString(PyExc_SystemError, "invalid multibyte sequence in 
python home path");
 return;
 }
+#endif
 if(len >= PATH_MAX + 1)
 {
 PyErr_SetString(PyExc_SystemError, "python home path is too long");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2021-01-01 Thread Mike Kaganski (via logerrit)
 pyuno/source/loader/pyuno_loader.cxx |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit cbe9a0a815e4a73bf8db425a7c5c651e67b2ed65
Author: Mike Kaganski 
AuthorDate: Mon Dec 28 19:23:10 2020 +0300
Commit: Mike Kaganski 
CommitDate: Fri Jan 1 18:03:00 2021 +0100

Use Unicode paths on Windows for pyuno

No need to convert to 8-byte string only to convert back to UTF-16.
No idea if this has some logic on Linux, so only changing Windows.

Change-Id: I87b7f25e5b1a2dd07ac3354f8f065485949ef229
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108480
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/pyuno/source/loader/pyuno_loader.cxx 
b/pyuno/source/loader/pyuno_loader.cxx
index a8722dd835bb..1337ea8c78f9 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -23,6 +23,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -109,16 +110,22 @@ static void setPythonHome ( const OUString & pythonHome )
 {
 OUString systemPythonHome;
 osl_getSystemPathFromFileURL( pythonHome.pData, &(systemPythonHome.pData) 
);
-OString o = OUStringToOString( systemPythonHome, 
osl_getThreadTextEncoding() );
 // static because Py_SetPythonHome just copies the "wide" pointer
 static wchar_t wide[PATH_MAX + 1];
+#if defined _WIN32
+const size_t len = systemPythonHome.getLength();
+if (len < std::size(wide))
+wcsncpy(wide, o3tl::toW(systemPythonHome.getStr()), len + 1);
+#else
+OString o = OUStringToOString(systemPythonHome, 
osl_getThreadTextEncoding());
 size_t len = mbstowcs(wide, o.pData->buffer, PATH_MAX + 1);
+#endif
 if(len == size_t(-1))
 {
 PyErr_SetString(PyExc_SystemError, "invalid multibyte sequence in 
python home path");
 return;
 }
-if(len == PATH_MAX + 1)
+if(len >= PATH_MAX + 1)
 {
 PyErr_SetString(PyExc_SystemError, "python home path is too long");
 return;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2021-01-01 Thread Mike Kaganski (via logerrit)
 pyuno/source/module/pyuno_runtime.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 279be72f26013dc75ad42bdeb2a3b9301a4326dc
Author: Mike Kaganski 
AuthorDate: Mon Dec 28 19:10:05 2020 +0300
Commit: Mike Kaganski 
CommitDate: Fri Jan 1 14:42:44 2021 +0100

UTF8 is not ASCII

Change-Id: Idb31b3d00f35e0f90a4420f250f7a04535f5fe0a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108476
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index 961014ebc74b..4e44245e2827 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -877,7 +877,7 @@ Any Runtime::extractUnoException( const PyRef & excType, 
const PyRef ,
 PyRef args( PyTuple_New( 1), SAL_NO_ACQUIRE, NOT_NULL );
 PyTuple_SetItem( args.get(), 0, excTraceback.getAcquired() );
 PyRef pyStr( PyObject_CallObject( 
extractTraceback.get(),args.get() ), SAL_NO_ACQUIRE);
-str = OUString::createFromAscii( PyUnicode_AsUTF8(pyStr.get()) 
);
+str = OUString::fromUtf8(PyUnicode_AsUTF8(pyStr.get()));
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2020-12-19 Thread David Ostrovsky (via logerrit)
 pyuno/source/module/pyuno_module.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 6dd1d2268487920e8bda44dfd169a5bda4d62f13
Author: David Ostrovsky 
AuthorDate: Fri Dec 18 11:25:05 2020 +0100
Commit: Michael Stahl 
CommitDate: Sat Dec 19 17:34:50 2020 +0100

tdf#138987 pyuno: PyEval_InitThreads is a no-op in Python 3.9

Change-Id: I7cf95ab1f237e315e8bd80b47758839bca34f970
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107946
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/pyuno/source/module/pyuno_module.cxx 
b/pyuno/source/module/pyuno_module.cxx
index 4a9d1921386f..35986b3646ba 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -883,7 +883,9 @@ PyObject* PyInit_pyuno()
 PyUNO_initType();
 PyUNOStruct_initType();
 // noop when called already, otherwise needed to allow multiple threads
+#if PY_VERSION_HEX < 0x0309
 PyEval_InitThreads();
+#endif
 static struct PyModuleDef moduledef =
 {
 PyModuleDef_HEAD_INIT,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2020-12-06 Thread Mike Kaganski (via logerrit)
 pyuno/source/loader/pythonloader.py |   21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

New commits:
commit 3e524922b93b1fe811d3b20f8f6cdf01461348ac
Author: Mike Kaganski 
AuthorDate: Mon Dec 7 09:09:24 2020 +0300
Commit: Mike Kaganski 
CommitDate: Mon Dec 7 08:14:46 2020 +0100

Wrap "open" into "with"

Change-Id: I1ecc16ddf565ac1f7306289fd51b673ed928cc20
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107329
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Mike Kaganski 

diff --git a/pyuno/source/loader/pythonloader.py 
b/pyuno/source/loader/pythonloader.py
index 7c16e226bad9..9a7114aea210 100644
--- a/pyuno/source/loader/pythonloader.py
+++ b/pyuno/source/loader/pythonloader.py
@@ -90,17 +90,16 @@ class Loader( XImplementationLoader, XServiceInfo, 
unohelper.Base ):
 # read the file
 filename = unohelper.fileUrlToSystemPath( url )
 
-fileHandle = open( filename, encoding='utf_8' )
-src = fileHandle.read().replace("\r","")
-if not src.endswith( "\n" ):
-src = src + "\n"
-
-# compile and execute the module
-codeobject = compile( src, encfile(filename), "exec" )
-mod.__file__ = filename
-exec(codeobject, mod.__dict__)
-g_loadedComponents[url] = mod
-fileHandle.close()
+with open( filename, encoding='utf_8' ) as fileHandle:
+src = fileHandle.read().replace("\r","")
+if not src.endswith( "\n" ):
+src = src + "\n"
+
+# compile and execute the module
+codeobject = compile( src, encfile(filename), "exec" )
+mod.__file__ = filename
+exec(codeobject, mod.__dict__)
+g_loadedComponents[url] = mod
 return mod
 elif "vnd.openoffice.pymodule" == protocol:
 nSlash = dependent.rfind('/')
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2020-12-04 Thread Julien Nabet (via logerrit)
 pyuno/source/loader/pythonloader.py |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 62887aa764e51a74d3b452abd2297a05d9a6bd3f
Author: Julien Nabet 
AuthorDate: Fri Dec 4 18:39:53 2020 +0100
Commit: Noel Grandin 
CommitDate: Fri Dec 4 20:02:57 2020 +0100

Fix ResourceWarning in pythonloader.py

trace:
/home/julien/lo/libreoffice/instdir/program/pythonloader.py:146: 
ResourceWarning: unclosed file <_io.TextIOWrapper 
name='/home/julien/lo/libreoffice/instdir/share/extensions/numbertext/reg.uno.py'
 mode='r' encoding='utf_8'>
  mod = self.getModuleFromUrl( locationUrl )
ResourceWarning: Enable tracemalloc to get the object allocation traceback

Change-Id: I106ab6c3c9024a8c1a4624a3b64958dc205e30e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107232
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/pyuno/source/loader/pythonloader.py 
b/pyuno/source/loader/pythonloader.py
index 5b824a3c26a1..7c16e226bad9 100644
--- a/pyuno/source/loader/pythonloader.py
+++ b/pyuno/source/loader/pythonloader.py
@@ -100,6 +100,7 @@ class Loader( XImplementationLoader, XServiceInfo, 
unohelper.Base ):
 mod.__file__ = filename
 exec(codeobject, mod.__dict__)
 g_loadedComponents[url] = mod
+fileHandle.close()
 return mod
 elif "vnd.openoffice.pymodule" == protocol:
 nSlash = dependent.rfind('/')
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2020-11-05 Thread Noel (via logerrit)
 pyuno/source/module/pyuno.cxx  |4 +---
 pyuno/source/module/pyuno_iterator.cxx |2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 00aafa2e0140742983ec6e6e916636d23794dfe3
Author: Noel 
AuthorDate: Thu Nov 5 11:24:50 2020 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 5 12:57:00 2020 +0100

loplugin:reducevarscope in pyuno

Change-Id: I49157f373b0d5919492a0ba4ccdcd545c58730a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105333
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 25aea6436032..25ae588d6d58 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -1363,14 +1363,12 @@ static int PyUNO_contains( PyObject *self, PyObject 
*pKey )
 
 static PyObject* PyUNO_getattr (PyObject* self, char* name)
 {
-PyUNO* me;
-
 try
 {
 
 Runtime runtime;
 
-me = reinterpret_cast(self);
+PyUNO* me = reinterpret_cast(self);
 if (strcmp (name, "__dict__") == 0)
 {
 Py_INCREF (Py_TYPE(me)->tp_dict);
diff --git a/pyuno/source/module/pyuno_iterator.cxx 
b/pyuno/source/module/pyuno_iterator.cxx
index 840fc977014a..b5dcf78695a8 100644
--- a/pyuno/source/module/pyuno_iterator.cxx
+++ b/pyuno/source/module/pyuno_iterator.cxx
@@ -211,10 +211,10 @@ static PyObject* PyUNO_list_iterator_next( PyObject *self 
)
 
 Runtime runtime;
 Any aRet;
-bool noMoreElements = false;
 
 try
 {
+bool noMoreElements = false;
 {
 PyThreadDetach antiguard;
 try {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2020-10-23 Thread Stephan Bergmann (via logerrit)
 pyuno/source/module/pyuno.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 82ade9ab29425b4c76b1a2073325d1269158dc03
Author: Stephan Bergmann 
AuthorDate: Fri Oct 23 11:08:03 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Oct 23 17:16:06 2020 +0200

PyLong_AsLongAndOverflow returns long, and that's fine to use here

...where the goal is to check for a value in the range
[SAL_MIN_INT32 .. SAL_MAX_INT32], i.e., [-2^31 .. 2^31 - 1]:  While C++17 
(via C
LONG_MIN, LONG_MAX) only guarantees a range of [-(2^31 - 1) .. 2^31 - 1] for
long, C++20 now requires two's complement and a fitting range of at least
[-2^31 .. 2^31 - 1].

No need for 0d79d216886a71436e705c93829ed66a33270a9c "long->tools::Long in
pyuno..sd" here.

Change-Id: I6be60b50acfe5ed798cc8e9e1183c336c8d72059
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104712
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 527bcdbf76b5..25aea6436032 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -24,7 +24,6 @@
 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -319,7 +318,7 @@ static sal_Int32 lcl_PyNumber_AsSal_Int32( PyObject *pObj )
 // Convert Python number to platform long, then check actual value against
 // bounds of sal_Int32
 int nOverflow;
-tools::Long nResult = PyLong_AsLongAndOverflow( pObj,  );
+long nResult = PyLong_AsLongAndOverflow( pObj,  );
 if ( nOverflow || nResult > SAL_MAX_INT32 || nResult < SAL_MIN_INT32) {
 PyErr_SetString( PyExc_IndexError, "Python int too large to convert to 
UNO long" );
 return -1;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source reportdesign/source sax/source sd/inc sd/qa sd/source

2020-10-23 Thread Noel (via logerrit)
 pyuno/source/module/pyuno.cxx  |3 
 reportdesign/source/ui/dlg/GroupsSorting.cxx   |   40 +--
 reportdesign/source/ui/inc/SectionWindow.hxx   |2 
 reportdesign/source/ui/report/DesignView.cxx   |   10 
 reportdesign/source/ui/report/EndMarker.cxx|4 
 reportdesign/source/ui/report/ReportWindow.cxx |   24 +-
 reportdesign/source/ui/report/ScrollHelper.cxx |   10 
 reportdesign/source/ui/report/SectionWindow.cxx|   10 
 reportdesign/source/ui/report/StartMarker.cxx  |   26 +-
 reportdesign/source/ui/report/ViewsWindow.cxx  |   40 +--
 reportdesign/source/ui/report/dlgedfunc.cxx|   10 
 sax/source/tools/converter.cxx |7 
 sd/inc/CustomAnimationEffect.hxx   |3 
 sd/inc/drawdoc.hxx |   16 -
 sd/qa/unit/export-tests-ooxml2.cxx |4 
 sd/qa/unit/import-tests.cxx|   16 -
 sd/qa/unit/tiledrendering/tiledrendering.cxx   |8 
 sd/source/core/drawdoc.cxx |   16 -
 sd/source/core/drawdoc2.cxx|8 
 sd/source/core/sdpage.cxx  |  104 
+-
 sd/source/filter/eppt/epptso.cxx   |4 
 sd/source/filter/grf/sdgrffilter.cxx   |4 
 sd/source/filter/html/htmlex.cxx   |   26 +-
 sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx  |2 
 sd/source/ui/animations/CustomAnimationDialog.cxx  |   20 -
 sd/source/ui/animations/CustomAnimationList.cxx|   16 -
 sd/source/ui/animations/motionpathtag.cxx  |4 
 sd/source/ui/annotations/annotationtag.cxx |   10 
 sd/source/ui/annotations/annotationwindow.cxx  |   14 -
 sd/source/ui/annotations/annotationwindow.hxx  |6 
 sd/source/ui/app/sdmod2.cxx|2 
 sd/source/ui/dlg/BulletAndPositionDlg.cxx  |   36 +--
 sd/source/ui/dlg/animobjs.cxx  |   10 
 sd/source/ui/dlg/copydlg.cxx   |   46 ++--
 sd/source/ui/dlg/custsdlg.cxx  |6 
 sd/source/ui/dlg/dlgsnap.cxx   |2 
 sd/source/ui/dlg/headerfooterdlg.cxx   |4 
 sd/source/ui/dlg/navigatr.cxx  |2 
 sd/source/ui/dlg/present.cxx   |2 
 sd/source/ui/dlg/sdpreslt.cxx  |2 
 sd/source/ui/dlg/tpoption.cxx  |6 
 sd/source/ui/dlg/vectdlg.cxx   |   42 ++--
 sd/source/ui/docshell/sdclient.cxx |4 
 sd/source/ui/func/fucon3d.cxx  |2 
 sd/source/ui/func/fuconarc.cxx |4 
 sd/source/ui/func/fuconrec.cxx |8 
 sd/source/ui/func/fucopy.cxx   |   14 -
 sd/source/ui/func/fudraw.cxx   |2 
 sd/source/ui/func/fuediglu.cxx |4 
 sd/source/ui/func/fulinend.cxx |8 
 sd/source/ui/func/fumorph.cxx  |6 
 sd/source/ui/func/fuparagr.cxx |2 
 sd/source/ui/func/fupoor.cxx   |4 
 sd/source/ui/func/fusel.cxx|   10 
 sd/source/ui/func/fusldlg.cxx  |4 
 sd/source/ui/func/fuzoom.cxx   |2 
 sd/source/ui/func/sdundogr.cxx |6 
 sd/source/ui/inc/DrawViewShell.hxx |8 
 sd/source/ui/inc/OutlineViewShell.hxx  |2 
 sd/source/ui/inc/SlideSorterViewShell.hxx  |2 
 sd/source/ui/inc/ViewShell.hxx |   14 -
 sd/source/ui/inc/ViewShellBase.hxx |2 
 sd/source/ui/inc/Window.hxx|   21 +-
 sd/source/ui/inc/sdpreslt.hxx  |2 
 sd/source/ui/inc/unomodel.hxx  |4 
 sd/source/ui/inc/vectdlg.hxx   |4 
 sd/source/ui/sidebar/PageMarginUtils.hxx   |   56 ++---
 sd/source/ui/sidebar/SlideBackground.cxx   |4 
 sd/source/ui/sidebar/SlideBackground.hxx 

[Libreoffice-commits] core.git: pyuno/source

2020-10-02 Thread Stephan Bergmann (via logerrit)
 pyuno/source/loader/pythonloader.component |2 +-
 pyuno/source/loader/pyuno_loader.cxx   |9 +++--
 2 files changed, 4 insertions(+), 7 deletions(-)

New commits:
commit d94aa8bd603bec2027f6eed6ac63d8c1cc40e054
Author: Stephan Bergmann 
AuthorDate: Fri Oct 2 14:21:27 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Oct 2 21:12:20 2020 +0200

Use the new single-instance="true" attribute in pyuno

Change-Id: I953dcc31445fc76d219903da56b2cc264f28c220
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103848
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/source/loader/pythonloader.component 
b/pyuno/source/loader/pythonloader.component
index 4e22781a6e60..4fc4a255ca2e 100644
--- a/pyuno/source/loader/pythonloader.component
+++ b/pyuno/source/loader/pythonloader.component
@@ -20,7 +20,7 @@
 http://openoffice.org/2010/uno-components;>
   
+constructor="pyuno_Loader_get_implementation" single-instance="true">
 
   
 
diff --git a/pyuno/source/loader/pyuno_loader.cxx 
b/pyuno/source/loader/pyuno_loader.cxx
index db6acb04dbd8..a92a538161b1 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -172,9 +172,7 @@ static void prependPythonPath( const OUString & 
pythonPathBootstrap )
 
 namespace {
 
-struct PythonInit
-{
-PythonInit() {
+void pythonInit() {
 if ( Py_IsInitialized()) // may be inited by getComponentContext() already
 return;
 
@@ -228,7 +226,6 @@ PythonInit() {
 // PyThreadAttach below.
 PyThreadState_Delete(tstate);
 }
-};
 
 }
 
@@ -236,8 +233,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 pyuno_Loader_get_implementation(
 css::uno::XComponentContext* ctx , css::uno::Sequence 
const&)
 {
-// tdf#114815 thread-safe static to init python only once
-static PythonInit s_Init;
+// tdf#114815 init python only once, via single-instace="true" in 
pythonloader.component
+pythonInit();
 
 Reference< XInterface > ret;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2020-07-14 Thread Noel Grandin (via logerrit)
 pyuno/source/loader/pythonloader.component |5 ++-
 pyuno/source/loader/pyuno_loader.cxx   |   41 -
 2 files changed, 9 insertions(+), 37 deletions(-)

New commits:
commit 15b100506a61ccae6573e4969e525a981098344f
Author: Noel Grandin 
AuthorDate: Tue Jul 14 10:36:40 2020 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 14 15:49:24 2020 +0200

pyuno: create instances with uno constructors

See tdf#74608 for motivation.

Change-Id: I4bdc09b4ba5c2f7ecc4fc8184f2d8230896aef01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98716
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/pyuno/source/loader/pythonloader.component 
b/pyuno/source/loader/pythonloader.component
index b98b1cd57f36..4e22781a6e60 100644
--- a/pyuno/source/loader/pythonloader.component
+++ b/pyuno/source/loader/pythonloader.component
@@ -18,8 +18,9 @@
  -->
 
 http://openoffice.org/2010/uno-components;>
-  
+xmlns="http://openoffice.org/2010/uno-components;>
+  
 
   
 
diff --git a/pyuno/source/loader/pyuno_loader.cxx 
b/pyuno/source/loader/pyuno_loader.cxx
index 9df4ecfb770e..db6acb04dbd8 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -106,16 +106,6 @@ static PyRef getObjectFromLoaderModule( const char * func )
 return object;
 }
 
-static OUString getImplementationName()
-{
-return "org.openoffice.comp.pyuno.Loader";
-}
-
-static Sequence< OUString > getSupportedServiceNames()
-{
-return { "com.sun.star.loader.Python" };
-}
-
 static void setPythonHome ( const OUString & pythonHome )
 {
 OUString systemPythonHome;
@@ -242,7 +232,9 @@ PythonInit() {
 
 }
 
-static Reference CreateInstance(const Reference 
& ctx)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+pyuno_Loader_get_implementation(
+css::uno::XComponentContext* ctx , css::uno::Sequence 
const&)
 {
 // tdf#114815 thread-safe static to init python only once
 static PythonInit s_Init;
@@ -262,7 +254,7 @@ static Reference CreateInstance(const 
Reference &
 Runtime runtime;
 
 PyRef pyCtx = runtime.any2PyObject(
-css::uno::makeAny( ctx ) );
+css::uno::makeAny( css::uno::Reference(ctx) ) );
 
 PyRef clazz = getObjectFromLoaderModule( "Loader" );
 PyRef args ( PyTuple_New( 1 ), SAL_NO_ACQUIRE, NOT_NULL );
@@ -270,29 +262,8 @@ static Reference CreateInstance(const 
Reference &
 PyRef pyInstance( PyObject_CallObject( clazz.get() , args.get() ), 
SAL_NO_ACQUIRE );
 runtime.pyObject2Any( pyInstance ) >>= ret;
 }
-return ret;
-}
-
-}
-
-
-const struct cppu::ImplementationEntry g_entries[] =
-{
-{
-pyuno_loader::CreateInstance, pyuno_loader::getImplementationName,
-pyuno_loader::getSupportedServiceNames, 
cppu::createSingleComponentFactory,
-nullptr , 0
-},
-{ nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-};
-
-extern "C"
-{
-
-SAL_DLLPUBLIC_EXPORT void * pythonloader_component_getFactory(
-const char * pImplName, void * pServiceManager, void * pRegistryKey )
-{
-return cppu::component_getFactoryHelper( pImplName, pServiceManager, 
pRegistryKey , g_entries );
+ret->acquire();
+return ret.get();
 }
 
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2020-07-01 Thread Stephan Bergmann (via logerrit)
 pyuno/source/loader/pyuno_loader.cxx |2 +-
 pyuno/source/module/pyuno_impl.hxx   |   10 +-
 pyuno/source/module/pyuno_module.cxx |2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 71999016feeb371b5f3eb1d2f71385176039db06
Author: Stephan Bergmann 
AuthorDate: Wed Jul 1 14:18:51 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Jul 1 16:43:14 2020 +0200

Upcoming improved loplugin:staticanonymous -> redundantstatic: pyuno

Change-Id: I188716d5da92d495b9511f000dd9c1a78259fa9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97621
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/source/loader/pyuno_loader.cxx 
b/pyuno/source/loader/pyuno_loader.cxx
index 07dc748235f9..9df4ecfb770e 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -276,7 +276,7 @@ static Reference CreateInstance(const 
Reference &
 }
 
 
-static const struct cppu::ImplementationEntry g_entries[] =
+const struct cppu::ImplementationEntry g_entries[] =
 {
 {
 pyuno_loader::CreateInstance, pyuno_loader::getImplementationName,
diff --git a/pyuno/source/module/pyuno_impl.hxx 
b/pyuno/source/module/pyuno_impl.hxx
index 05ff32252670..6517884a01ef 100644
--- a/pyuno/source/module/pyuno_impl.hxx
+++ b/pyuno/source/module/pyuno_impl.hxx
@@ -70,9 +70,9 @@ struct RuntimeCargo;
 namespace LogLevel
 {
 // when you add a loglevel, extend the log function !
-static const sal_Int32 NONE = 0;
-static const sal_Int32 CALL = 1;
-static const sal_Int32 ARGS = 2;
+const sal_Int32 NONE = 0;
+const sal_Int32 CALL = 1;
+const sal_Int32 ARGS = 2;
 }
 
 bool isLog( RuntimeCargo const *cargo, sal_Int32 loglevel );
@@ -88,8 +88,8 @@ void logReply( RuntimeCargo *cargo, const char *intro,
 void logException( RuntimeCargo *cargo, const char *intro,
void * ptr, const OUString ,
const void * data, const css::uno::Type & type );
-static const sal_Int32 VAL2STR_MODE_DEEP = 0;
-static const sal_Int32 VAL2STR_MODE_SHALLOW = 1;
+const sal_Int32 VAL2STR_MODE_DEEP = 0;
+const sal_Int32 VAL2STR_MODE_SHALLOW = 1;
 OUString val2str( const void * pVal, typelib_TypeDescriptionReference * 
pTypeRef, sal_Int32 mode = VAL2STR_MODE_DEEP );
 
 
diff --git a/pyuno/source/module/pyuno_module.cxx 
b/pyuno/source/module/pyuno_module.cxx
index 579da0a583a0..cb2824d5 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -313,7 +313,7 @@ static PyObject* getComponentContext(
 // exactly once near the end of the process, if InitVCL has ever been called 
via
 // pyuno.private_initTestEnvironment):
 
-static osl::Module * testModule = nullptr;
+osl::Module * testModule = nullptr;
 
 static PyObject* initTestEnvironment(
 SAL_UNUSED_PARAMETER PyObject*, SAL_UNUSED_PARAMETER PyObject*)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2020-06-19 Thread Caolán McNamara (via logerrit)
 pyuno/source/loader/pyuno_loader.cxx |   14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 327153471ae38abe90463f6272e00aaa996c5ba3
Author: Caolán McNamara 
AuthorDate: Fri Jun 19 11:32:00 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jun 19 21:14:16 2020 +0200

tdf#121384 don't leave a bare trailing : in PYTHONPATH

and don't insert any empty path entries if that situation
was to arise

Change-Id: I8d8183485f457c3e4385181fee07390c4bfef603
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96713
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/pyuno/source/loader/pyuno_loader.cxx 
b/pyuno/source/loader/pyuno_loader.cxx
index 8556dfdde11f..07dc748235f9 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -140,6 +140,7 @@ static void setPythonHome ( const OUString & pythonHome )
 static void prependPythonPath( const OUString & pythonPathBootstrap )
 {
 OUStringBuffer bufPYTHONPATH( 256 );
+bool bAppendSep = false;
 sal_Int32 nIndex = 0;
 while( true )
 {
@@ -155,15 +156,24 @@ static void prependPythonPath( const OUString & 
pythonPathBootstrap )
 }
 OUString systemPath;
 osl_getSystemPathFromFileURL( fileUrl.pData, &(systemPath.pData) );
-bufPYTHONPATH.append( systemPath );
-bufPYTHONPATH.append( static_cast(SAL_PATHSEPARATOR) );
+if (!systemPath.isEmpty())
+{
+if (bAppendSep)
+
bufPYTHONPATH.append(static_cast(SAL_PATHSEPARATOR));
+bufPYTHONPATH.append(systemPath);
+bAppendSep = true;
+}
 if( nNew == -1 )
 break;
 nIndex = nNew + 1;
 }
 const char * oldEnv = getenv( "PYTHONPATH");
 if( oldEnv )
+{
+if (bAppendSep)
+bufPYTHONPATH.append( static_cast(SAL_PATHSEPARATOR) 
);
 bufPYTHONPATH.append( OUString(oldEnv, strlen(oldEnv), 
osl_getThreadTextEncoding()) );
+}
 
 OUString envVar("PYTHONPATH");
 OUString envValue(bufPYTHONPATH.makeStringAndClear());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2020-05-20 Thread Noel Grandin (via logerrit)
 pyuno/source/loader/pythonloader.py |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 0a3d414fb0ac27292320d99f802722a8a9670240
Author: Noel Grandin 
AuthorDate: Wed May 20 11:35:09 2020 +0200
Commit: Noel Grandin 
CommitDate: Wed May 20 12:37:38 2020 +0200

fix some more python 3.8 deprecation warnings

Change-Id: I8bdbf05f1357aea83a3cdda2f06d63c7d04de8f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94561
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/pyuno/source/loader/pythonloader.py 
b/pyuno/source/loader/pythonloader.py
index 4233c0e7ca6e..5b824a3c26a1 100644
--- a/pyuno/source/loader/pythonloader.py
+++ b/pyuno/source/loader/pythonloader.py
@@ -19,7 +19,7 @@
 import uno
 import unohelper
 import sys
-import imp
+import types
 import os
 from com.sun.star.uno import Exception,RuntimeException
 from com.sun.star.loader import XImplementationLoader
@@ -82,7 +82,7 @@ class Loader( XImplementationLoader, XServiceInfo, 
unohelper.Base ):
 # did we load the module already ?
 mod = g_loadedComponents.get( url )
 if not mod:
-mod = imp.new_module("uno_component")
+mod = types.ModuleType("uno_component")
 
 # check for pythonpath.zip beside .py files
 checkForPythonPathBesideComponent( url[0:url.rfind('/')] )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2020-05-12 Thread Stephan Bergmann (via logerrit)
 pyuno/source/module/pyuno.cxx  |4 ++--
 pyuno/source/module/pyuno_callable.cxx |4 ++--
 pyuno/source/module/pyuno_iterator.cxx |8 
 pyuno/source/module/pyuno_runtime.cxx  |4 ++--
 pyuno/source/module/pyuno_struct.cxx   |4 ++--
 5 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 23d9966751566028c50ca95ca203d20f36c64f30
Author: Stephan Bergmann 
AuthorDate: Mon May 11 22:46:12 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Tue May 12 08:24:16 2020 +0200

Fix initialization of Python-3.8--only at-end tp_print member

Until Python 3.7, PyTypeObject had a member tp_print following tp_dealloc, 
which
had then been repurposed as

>  /* Methods to implement standard operations */
>
>  destructor tp_dealloc;
> -printfunc tp_print;
> +Py_ssize_t tp_vectorcall_offset;
>  getattrfunc tp_getattr;
>  setattrfunc tp_setattr;
>  PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 
2)

in  "bpo-36974: implement PEP 590
(GH-13185)" towards Python 3.8.  Then only on the 3.8 branch (and prior to 
tag
v3.8.0),  "[3.8] bpo-37250: put back 
tp_print
for backwards compatibility (GH-14193)" added

>  destructor tp_finalize;
>  vectorcallfunc tp_vectorcall;
>
> +/* bpo-37250: kept for backwards compatibility in CPython 3.8 only */
> +Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);
> +
>  #ifdef COUNT_ALLOCS
>  /* these must be last and never explicitly initialized */
>  Py_ssize_t tp_allocs;

at the end of PyTypeObject.  This was apparently done so that third-party 
code
containing initialization code like

  X.tp_print = 0;

would continue to compile (by just adding back a member with that name, 
even if
at a "random" new---and otherwise unused---location).  However, for our way 
of
list-initializing PyTypeObject instances in pyuno that new member caused
"missing field 'tp_print' initializer" -Wmissing-field-initializers 
warnings, so
50ccb7e82b7053306721cbe220323be072306a29 "python 3.8.2 compile: add 
tp_print to
PyTypeObject" added initializers for this new at-end member.  But it did so 
in a
way that raises three concerns:

1  The new member was already added in Python 3.8.0 (prior to tag v3.8.0), 
not
   only in 3.8.2.

2  The new member was only added to Python 3.8.  It has not been added to
   current master towards 3.9.

3  It is unclear why the comments mention "Py_ssize_t" as the type of that 
new
   member, when actually it is of a function pointer type (see above).  
Probably
   best to just drop that from the comments, to avoid confusion.

Change-Id: Ib44f43befd5f28d4c1ac1e9e14bd55bfb4473507
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94019
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index ba60f04bbcaa..25aea6436032 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -1660,12 +1660,12 @@ static PyTypeObject PyUNOType =
 , nullptr
 #if PY_VERSION_HEX >= 0x0308
 , nullptr // vectorcallfunc tp_vectorcall
-#if PY_VERSION_HEX >= 0x03080200
+#if PY_VERSION_HEX < 0x0309
 #if defined __clang__
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
 #endif
-, nullptr //Py_ssize_t tp_print
+, nullptr // tp_print
 #if defined __clang__
 #pragma clang diagnostic pop
 #endif
diff --git a/pyuno/source/module/pyuno_callable.cxx 
b/pyuno/source/module/pyuno_callable.cxx
index 867a7f917aa0..1c138f71b419 100644
--- a/pyuno/source/module/pyuno_callable.cxx
+++ b/pyuno/source/module/pyuno_callable.cxx
@@ -235,12 +235,12 @@ static PyTypeObject PyUNO_callable_Type =
 , nullptr
 #if PY_VERSION_HEX >= 0x0308
 , nullptr // vectorcallfunc tp_vectorcall
-#if PY_VERSION_HEX >= 0x03080200
+#if PY_VERSION_HEX < 0x0309
 #if defined __clang__
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
 #endif
-, nullptr //Py_ssize_t tp_print
+, nullptr // tp_print
 #if defined __clang__
 #pragma clang diagnostic pop
 #endif
diff --git a/pyuno/source/module/pyuno_iterator.cxx 
b/pyuno/source/module/pyuno_iterator.cxx
index 8337feba9a9d..840fc977014a 100644
--- a/pyuno/source/module/pyuno_iterator.cxx
+++ b/pyuno/source/module/pyuno_iterator.cxx
@@ -167,12 +167,12 @@ static PyTypeObject PyUNO_iterator_Type =
 , nullptr
 #if PY_VERSION_HEX >= 0x0308
 , nullptr // vectorcallfunc tp_vectorcall
-#if PY_VERSION_HEX >= 0x03080200
+#if PY_VERSION_HEX < 0x0309
 #if 

[Libreoffice-commits] core.git: pyuno/source

2020-05-11 Thread Stephan Bergmann (via logerrit)
 pyuno/source/module/pyuno.cxx  |   14 +++---
 pyuno/source/module/pyuno_callable.cxx |   14 +++---
 pyuno/source/module/pyuno_iterator.cxx |   28 ++--
 pyuno/source/module/pyuno_runtime.cxx  |   14 +++---
 pyuno/source/module/pyuno_struct.cxx   |   14 +++---
 5 files changed, 42 insertions(+), 42 deletions(-)

New commits:
commit 893a5249b934f92f072b89b9b558c9de593aa557
Author: Stephan Bergmann 
AuthorDate: Mon May 11 21:40:17 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Mon May 11 22:37:53 2020 +0200

More targeted silencing of -Wdeprecated-declarations

...compared to d1786724b8e8e474e1f7e39012c1f19611841dc0 "prevent warnings in
pyuno with latest python".  For one it is only the

  /* bpo-37250: kept for backwards compatibility in CPython 3.8 only */
  Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);

member (in /usr/include/python3.8/cpython/object.h) that causes a warning.  
And
for another it is only Clang that emits a warning when initializing a 
deprecated
member that way, 

"[cfe-dev] Diagnosing initialization of deprecated data member?"

Change-Id: I36625118a6bb26f5468d436da4caa82911181202
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94016
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 1b875b6891d0..ba60f04bbcaa 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -1603,10 +1603,6 @@ static PyMappingMethods PyUNOMappingMethods[] =
 PyUNO_setitem,   /* mp_ass_subscript */
 };
 
-#ifdef __GNUC__
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
 static PyTypeObject PyUNOType =
 {
 PyVarObject_HEAD_INIT( _Type, 0 )
@@ -1665,14 +1661,18 @@ static PyTypeObject PyUNOType =
 #if PY_VERSION_HEX >= 0x0308
 , nullptr // vectorcallfunc tp_vectorcall
 #if PY_VERSION_HEX >= 0x03080200
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+#endif
 , nullptr //Py_ssize_t tp_print
+#if defined __clang__
+#pragma clang diagnostic pop
 #endif
 #endif
 #endif
-};
-#ifdef __GNUC__
-#pragma GCC diagnostic pop
 #endif
+};
 
 int PyUNO_initType()
 {
diff --git a/pyuno/source/module/pyuno_callable.cxx 
b/pyuno/source/module/pyuno_callable.cxx
index 548c2bcef7dc..867a7f917aa0 100644
--- a/pyuno/source/module/pyuno_callable.cxx
+++ b/pyuno/source/module/pyuno_callable.cxx
@@ -178,10 +178,6 @@ static PyObject* PyUNO_callable_call(
 }
 
 
-#ifdef __GNUC__
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
 static PyTypeObject PyUNO_callable_Type =
 {
 PyVarObject_HEAD_INIT( _Type, 0 )
@@ -240,14 +236,18 @@ static PyTypeObject PyUNO_callable_Type =
 #if PY_VERSION_HEX >= 0x0308
 , nullptr // vectorcallfunc tp_vectorcall
 #if PY_VERSION_HEX >= 0x03080200
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+#endif
 , nullptr //Py_ssize_t tp_print
+#if defined __clang__
+#pragma clang diagnostic pop
 #endif
 #endif
 #endif
-};
-#ifdef __GNUC__
-#pragma GCC diagnostic pop
 #endif
+};
 
 PyRef PyUNO_callable_new (
 const Reference _inv,
diff --git a/pyuno/source/module/pyuno_iterator.cxx 
b/pyuno/source/module/pyuno_iterator.cxx
index 9258b780a304..8337feba9a9d 100644
--- a/pyuno/source/module/pyuno_iterator.cxx
+++ b/pyuno/source/module/pyuno_iterator.cxx
@@ -110,10 +110,6 @@ static PyObject* PyUNO_iterator_next( PyObject *self )
 return nullptr;
 }
 
-#ifdef __GNUC__
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
 static PyTypeObject PyUNO_iterator_Type =
 {
 PyVarObject_HEAD_INIT( _Type, 0 )
@@ -172,14 +168,18 @@ static PyTypeObject PyUNO_iterator_Type =
 #if PY_VERSION_HEX >= 0x0308
 , nullptr // vectorcallfunc tp_vectorcall
 #if PY_VERSION_HEX >= 0x03080200
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+#endif
 , nullptr //Py_ssize_t tp_print
+#if defined __clang__
+#pragma clang diagnostic pop
 #endif
 #endif
 #endif
-};
-#ifdef __GNUC__
-#pragma GCC diagnostic pop
 #endif
+};
 
 PyObject* PyUNO_iterator_new( const Reference< XEnumeration >& xEnumeration )
 {
@@ -256,10 +256,6 @@ static PyObject* PyUNO_list_iterator_next( PyObject *self )
 return nullptr;
 }
 
-#ifdef __GNUC__
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
 static PyTypeObject PyUNO_list_iterator_Type =
 {
 PyVarObject_HEAD_INIT( _Type, 0 )
@@ -318,14 +314,18 @@ static PyTypeObject PyUNO_list_iterator_Type =
 #if PY_VERSION_HEX >= 0x0308
  

[Libreoffice-commits] core.git: pyuno/source

2020-04-09 Thread Michael Stahl (via logerrit)
 pyuno/source/module/pyuno.cxx |   10 
 pyuno/source/module/pyuno_impl.hxx|   41 --
 pyuno/source/module/pyuno_module.cxx  |   20 
 pyuno/source/module/pyuno_runtime.cxx |   18 +++---
 pyuno/source/module/pyuno_struct.cxx  |2 -
 pyuno/source/module/pyuno_type.cxx|   22 +-
 pyuno/source/module/pyuno_util.cxx|2 -
 7 files changed, 37 insertions(+), 78 deletions(-)

New commits:
commit 086142ba70c51be7487a40d433dc75656f637cdf
Author: Michael Stahl 
AuthorDate: Sat Apr 4 20:16:28 2020 +0200
Commit: Michael Stahl 
CommitDate: Thu Apr 9 16:44:01 2020 +0200

pyuno: sed Python2/3 string compatibility wrappers

Change-Id: I9ed25c5efaa4b447ab14a497a58bbe1147a6e7b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91698
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 1b76a3fb6a9d..bdd717cc397e 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -461,7 +461,7 @@ PyObject *PyUNO_str( PyObject * self )
 buf = "pyuno object " + OUStringToOString(s,RTL_TEXTENCODING_ASCII_US);
 }
 
-return PyStr_FromString( buf.getStr() );
+return PyUnicode_FromString( buf.getStr() );
 }
 
 static PyObject* PyUNO_dir (PyObject* self)
@@ -592,7 +592,7 @@ static PyObject* lcl_getitem_XCellRange( PyUNO const * me, 
PyObject* pKey )
 Any aRet;
 
 // Single string key is sugar for getCellRangeByName()
-if ( PyStr_Check( pKey ) ) {
+if ( PyUnicode_Check( pKey ) ) {
 
 aParams.realloc (1);
 aParams[0] <<= pyString2ustring( pKey );
@@ -822,7 +822,7 @@ static PyObject* PyUNO_getitem( PyObject *self, PyObject 
*pKey )
 }
 
 // XNameAccess access by key
-if ( PyStr_Check( pKey ) )
+if ( PyUnicode_Check( pKey ) )
 {
 PyObject* pRet = lcl_getitem_string( me, pKey, runtime );
 if ( pRet != nullptr )
@@ -1157,7 +1157,7 @@ static int PyUNO_setitem( PyObject *self, PyObject *pKey, 
PyObject *pValue )
 {
 return lcl_setitem_slice( me, pKey, pValue );
 }
-else if ( PyStr_Check( pKey ) )
+else if ( PyUnicode_Check( pKey ) )
 {
 return lcl_setitem_string( me, pKey, pValue );
 }
@@ -1297,7 +1297,7 @@ static int PyUNO_contains( PyObject *self, PyObject *pKey 
)
 // useful for objects which implement both XIndexAccess and XNameAccess
 
 // For XNameAccess
-if ( PyStr_Check( pKey ) )
+if ( PyUnicode_Check( pKey ) )
 {
 OUString sKey;
 aValue >>= sKey;
diff --git a/pyuno/source/module/pyuno_impl.hxx 
b/pyuno/source/module/pyuno_impl.hxx
index 44d6bb8985a6..05ff32252670 100644
--- a/pyuno/source/module/pyuno_impl.hxx
+++ b/pyuno/source/module/pyuno_impl.hxx
@@ -60,47 +60,6 @@ namespace com::sun::star::script { class XInvocation2; }
 namespace com::sun::star::script { class XInvocationAdapterFactory2; }
 namespace com::sun::star::script { class XTypeConverter; }
 
-// In Python 3, the PyString_* functions have been replaced by PyBytes_*
-// and PyUnicode_* functions.
-
-// compatibility wrappers for Python "str" type (PyUnicode in 3, PyString in 2)
-inline PyObject* PyStr_FromString(const char *string)
-{
-return PyUnicode_FromString(string);
-}
-
-inline char const * PyStr_AsString(PyObject *object)
-{
-return PyUnicode_AsUTF8(object);
-}
-
-inline bool PyStr_Check(PyObject const *object)
-{
-return PyUnicode_Check(object);
-}
-
-// compatibility wrappers for Python non-Unicode string/buffer type
-// (PyBytes in 3, PyString in 2)
-inline bool PyStrBytes_Check(PyObject const *object)
-{
-return PyBytes_Check(object);
-}
-
-inline char* PyStrBytes_AsString(PyObject *object)
-{
-return PyBytes_AsString(object);
-}
-
-inline Py_ssize_t PyStrBytes_Size(PyObject *object)
-{
-return PyBytes_Size(object);
-}
-
-inline PyObject* PyStrBytes_FromStringAndSize(const char *string, Py_ssize_t 
len)
-{
-return PyBytes_FromStringAndSize(string, len);
-}
-
 namespace pyuno
 {
 
diff --git a/pyuno/source/module/pyuno_module.cxx 
b/pyuno/source/module/pyuno_module.cxx
index df7874467503..579da0a583a0 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -156,7 +156,7 @@ void fillStruct(
 {
 const OUString OUMemberName (pCompType->ppMemberNames[i]);
 PyObject *pyMemberName =
-PyStr_FromString(OUStringToOString(OUMemberName,
+PyUnicode_FromString(OUStringToOString(OUMemberName,
 RTL_TEXTENCODING_UTF8).getStr());
 if ( PyObject *element = PyDict_GetItem(kwinitializer, 
pyMemberName ) )
 {
@@ -390,7 +390,7 @@ PyObject * extractOneStringArg( PyObject *args, char const 
*funcName )
 return nullptr;
 }
  

[Libreoffice-commits] core.git: pyuno/source

2020-04-03 Thread Noel Grandin (via logerrit)
 pyuno/source/loader/pyuno_loader.cxx  |   82 +-
 pyuno/source/module/pyuno_module.cxx  |   26 +-
 pyuno/source/module/pyuno_runtime.cxx |   60 
 pyuno/source/module/pyuno_util.cxx|   54 +++---
 4 files changed, 111 insertions(+), 111 deletions(-)

New commits:
commit 50abf47628ad20c3104149a900313f62c34bac9f
Author: Noel Grandin 
AuthorDate: Fri Apr 3 10:43:38 2020 +0200
Commit: Noel Grandin 
CommitDate: Fri Apr 3 11:37:36 2020 +0200

loplugin:flatten in pyuno

Change-Id: I6074463579f1ffc18f5683a3c4b109402b650f9a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91613
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/pyuno/source/loader/pyuno_loader.cxx 
b/pyuno/source/loader/pyuno_loader.cxx
index b2a89749b98d..c7b7b7289b86 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -180,62 +180,62 @@ namespace {
 struct PythonInit
 {
 PythonInit() {
-if (! Py_IsInitialized()) // may be inited by getComponentContext() already
-{
-OUString pythonPath;
-OUString pythonHome;
-OUString path( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" 
SAL_CONFIGFILE("pythonloader.uno" ));
-rtl::Bootstrap::expandMacros(path); //TODO: detect failure
-rtl::Bootstrap bootstrap(path);
+if ( Py_IsInitialized()) // may be inited by getComponentContext() already
+return;
 
-// look for pythonhome
-bootstrap.getFrom( "PYUNO_LOADER_PYTHONHOME", pythonHome );
-bootstrap.getFrom( "PYUNO_LOADER_PYTHONPATH", pythonPath );
+OUString pythonPath;
+OUString pythonHome;
+OUString path( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" 
SAL_CONFIGFILE("pythonloader.uno" ));
+rtl::Bootstrap::expandMacros(path); //TODO: detect failure
+rtl::Bootstrap bootstrap(path);
 
-// 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() )
-setPythonHome( pythonHome );
+// look for pythonhome
+bootstrap.getFrom( "PYUNO_LOADER_PYTHONHOME", pythonHome );
+bootstrap.getFrom( "PYUNO_LOADER_PYTHONPATH", pythonPath );
 
-if( !pythonPath.isEmpty() )
-prependPythonPath( 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() )
+setPythonHome( pythonHome );
+
+if( !pythonPath.isEmpty() )
+prependPythonPath( pythonPath );
 
 #ifdef _WIN32
-//extend PATH under windows to include the branddir/program so ssl 
libs will be found
-//for use by terminal mailmerge dependency _ssl.pyd
-OUString sEnvName("PATH");
-OUString sPath;
-osl_getEnvironment(sEnvName.pData, );
-OUString sBrandLocation("$BRAND_BASE_DIR/program");
-rtl::Bootstrap::expandMacros(sBrandLocation);
-osl::FileBase::getSystemPathFromFileURL(sBrandLocation, 
sBrandLocation);
-sPath = OUStringBuffer(sPath).
-append(static_cast(SAL_PATHSEPARATOR)).
-append(sBrandLocation).makeStringAndClear();
-osl_setEnvironment(sEnvName.pData, sPath.pData);
+//extend PATH under windows to include the branddir/program so ssl libs 
will be found
+//for use by terminal mailmerge dependency _ssl.pyd
+OUString sEnvName("PATH");
+OUString sPath;
+osl_getEnvironment(sEnvName.pData, );
+OUString sBrandLocation("$BRAND_BASE_DIR/program");
+rtl::Bootstrap::expandMacros(sBrandLocation);
+osl::FileBase::getSystemPathFromFileURL(sBrandLocation, sBrandLocation);
+sPath = OUStringBuffer(sPath).
+append(static_cast(SAL_PATHSEPARATOR)).
+append(sBrandLocation).makeStringAndClear();
+osl_setEnvironment(sEnvName.pData, sPath.pData);
 #endif
 
 #if PY_MAJOR_VERSION >= 3
-PyImport_AppendInittab( "pyuno", PyInit_pyuno );
+PyImport_AppendInittab( "pyuno", PyInit_pyuno );
 #else
-PyImport_AppendInittab( (char*)"pyuno", initpyuno );
+PyImport_AppendInittab( (char*)"pyuno", initpyuno );
 #endif
 
 #if HAVE_FEATURE_READONLY_INSTALLSET
-Py_DontWriteBytecodeFlag = 1;
+Py_DontWriteBytecodeFlag = 1;
 #endif
 
-// initialize python
-Py_Initialize();
-PyEval_InitThreads();
+// initialize python
+Py_Initialize();
+PyEval_InitThreads();
 
-PyThreadState *tstate = PyThreadState_Get();
-PyEval_ReleaseThread( tstate );
-// This tstate is never used again, so delete it here.
-// This prevents an assertion in PyThreadState_Swap on the
-// PyThreadAttach below.
-

[Libreoffice-commits] core.git: pyuno/source

2020-02-21 Thread Justin Luth (via logerrit)
 pyuno/source/module/pyuno.cxx  |3 +++
 pyuno/source/module/pyuno_callable.cxx |3 +++
 pyuno/source/module/pyuno_iterator.cxx |6 ++
 pyuno/source/module/pyuno_runtime.cxx  |3 +++
 pyuno/source/module/pyuno_struct.cxx   |3 +++
 5 files changed, 18 insertions(+)

New commits:
commit 50ccb7e82b7053306721cbe220323be072306a29
Author: Justin Luth 
AuthorDate: Sat Feb 22 07:30:15 2020 +0300
Commit: Noel Grandin 
CommitDate: Sat Feb 22 07:43:02 2020 +0100

python 3.8.2 compile: add tp_print to PyTypeObject

I couldn't find this documented on the Internet though,
as the 3.9 and 3.8.2rc documentation didn't mention it
as an added item...

I'm using Ubuntu 20.04 alpha with python3 --version
Python 3.8.2rc1

This fixes pyuno/source/module/pyuno.cxx:1689:1: error:
missing initializer for member ‘_typeobject::tp_print’
[-Werror=missing-field-initializers]

Change-Id: Idec5720050572b34628267cd94557dabf7edbf3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89247
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index a6a875addc46..bf6e5c667b7c 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -1684,6 +1684,9 @@ static PyTypeObject PyUNOType =
 , nullptr
 #if PY_VERSION_HEX >= 0x0308
 , nullptr // vectorcallfunc tp_vectorcall
+#if PY_VERSION_HEX >= 0x03080200
+, 0 //Py_ssize_t tp_print
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_callable.cxx 
b/pyuno/source/module/pyuno_callable.cxx
index 9be3e1f1aef8..4803a30f814d 100644
--- a/pyuno/source/module/pyuno_callable.cxx
+++ b/pyuno/source/module/pyuno_callable.cxx
@@ -235,6 +235,9 @@ static PyTypeObject PyUNO_callable_Type =
 , nullptr
 #if PY_VERSION_HEX >= 0x0308
 , nullptr // vectorcallfunc tp_vectorcall
+#if PY_VERSION_HEX >= 0x03080200
+, 0 //Py_ssize_t tp_print
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_iterator.cxx 
b/pyuno/source/module/pyuno_iterator.cxx
index a7862857d719..6ba7f96a9632 100644
--- a/pyuno/source/module/pyuno_iterator.cxx
+++ b/pyuno/source/module/pyuno_iterator.cxx
@@ -168,6 +168,9 @@ static PyTypeObject PyUNO_iterator_Type =
 , nullptr
 #if PY_VERSION_HEX >= 0x0308
 , nullptr // vectorcallfunc tp_vectorcall
+#if PY_VERSION_HEX >= 0x03080200
+, 0 //Py_ssize_t tp_print
+#endif
 #endif
 #endif
 };
@@ -305,6 +308,9 @@ static PyTypeObject PyUNO_list_iterator_Type =
 , nullptr
 #if PY_VERSION_HEX >= 0x0308
 , nullptr // vectorcallfunc tp_vectorcall
+#if PY_VERSION_HEX >= 0x03080200
+, 0 //Py_ssize_t tp_print
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index 823355a900da..5182f57ab201 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -126,6 +126,9 @@ static PyTypeObject RuntimeImpl_Type =
 , nullptr
 #if PY_VERSION_HEX >= 0x0308
 , nullptr // vectorcallfunc tp_vectorcall
+#if PY_VERSION_HEX >= 0x03080200
+, 0 //Py_ssize_t tp_print
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_struct.cxx 
b/pyuno/source/module/pyuno_struct.cxx
index 50b74126bee9..56b71cdf5cc4 100644
--- a/pyuno/source/module/pyuno_struct.cxx
+++ b/pyuno/source/module/pyuno_struct.cxx
@@ -347,6 +347,9 @@ static PyTypeObject PyUNOStructType =
 , nullptr
 #if PY_VERSION_HEX >= 0x0308
 , nullptr // vectorcallfunc tp_vectorcall
+#if PY_VERSION_HEX >= 0x03080200
+, 0 //Py_ssize_t tp_print
+#endif
 #endif
 #endif
 };
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source scripting/source

2020-01-28 Thread Mike Kaganski (via logerrit)
 pyuno/source/loader/pythonloader.py  |2 +-
 scripting/source/pyprov/mailmerge.py |   10 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit a76d229fa9d800e96d88f5f37981251722e153e6
Author: Mike Kaganski 
AuthorDate: Mon Jan 27 07:18:20 2020 +0100
Commit: Mike Kaganski 
CommitDate: Tue Jan 28 13:01:26 2020 +0100

sys.version is for displaying; use sys.version_info for version check

Change-Id: If0d26019d9f842bcf56c1e01c46cc86c21523c3b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87476
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/pyuno/source/loader/pythonloader.py 
b/pyuno/source/loader/pythonloader.py
index 268cb168fe3c..5ce69f62ea7e 100644
--- a/pyuno/source/loader/pythonloader.py
+++ b/pyuno/source/loader/pythonloader.py
@@ -90,7 +90,7 @@ class Loader( XImplementationLoader, XServiceInfo, 
unohelper.Base ):
 # read the file
 filename = unohelper.fileUrlToSystemPath( url )
 
-if sys.version >= '3':
+if sys.version_info >= (3,0):
 fileHandle = open( filename, encoding='utf_8' )
 else:
 fileHandle = open( filename )
diff --git a/scripting/source/pyprov/mailmerge.py 
b/scripting/source/pyprov/mailmerge.py
index 079744007816..fadceb1e1e56 100644
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -127,7 +127,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
user = xAuthenticator.getUserName()
password = xAuthenticator.getPassword()
if user != '':
-   if sys.version < '3': # fdo#59249 i#105669 Python 2 
needs "ascii"
+   if sys.version_info < (3,0): # fdo#59249 i#105669 
Python 2 needs "ascii"
user = user.encode('ascii')
password = password.encode('ascii')
if dbg:
@@ -198,8 +198,8 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
except:
#it's a bytesequence, get raw 
bytes
textbody = textbody.value
-   if sys.version >= '3':
-   if sys.version_info.minor < 3 
or (sys.version_info.minor == 3 and sys.version_info.micro <= 1):
+   if sys.version_info >= (3,0):
+   if sys.version_info <= (3,1):

#http://stackoverflow.com/questions/9403265/how-do-i-use-python-3-2-email-module-to-send-unicode-messages-encoded-in-utf-8-w
#see 
http://bugs.python.org/16564, etc. basically it now *seems* to be all ok
#in python 3.3.2 
onwards, but a little busted in 3.3.0
@@ -333,7 +333,7 @@ class PyMailIMAPService(unohelper.Base, XMailService):
user = xAuthenticator.getUserName()
password = xAuthenticator.getPassword()
if user != '':
-   if sys.version < '3': # fdo#59249 i#105669 Python 2 
needs "ascii"
+   if sys.version_info < (3,0): # fdo#59249 i#105669 
Python 2 needs "ascii"
user = user.encode('ascii')
password = password.encode('ascii')
if dbg:
@@ -411,7 +411,7 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
 
user = xAuthenticator.getUserName()
password = xAuthenticator.getPassword()
-   if sys.version < '3': # fdo#59249 i#105669 Python 2 needs 
"ascii"
+   if sys.version_info < (3,0): # fdo#59249 i#105669 Python 2 
needs "ascii"
user = user.encode('ascii')
password = password.encode('ascii')
if dbg:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2020-01-09 Thread Michael Stahl (via logerrit)
 pyuno/source/module/pyuno_runtime.cxx |7 ---
 1 file changed, 7 deletions(-)

New commits:
commit 777ae8101e23a31bdf806c1d09f0c849e47bb8ef
Author: Michael Stahl 
AuthorDate: Thu Jan 9 12:41:06 2020 +0100
Commit: Michael Stahl 
CommitDate: Thu Jan 9 13:55:45 2020 +0100

pyuno: remove racy debug check

The use-after-free is easier to trigger than expected; i don't see how
it's possible to check this without a race.

Change-Id: I4afb7066d1bf6b34f4f56aa0f51be0643ae40a66
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86481
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index 3e2bb0c6b0a6..823355a900da 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -978,13 +978,6 @@ PyThreadAttach::PyThreadAttach( PyInterpreterState *interp)
 {
 // note: *may* be called recursively, with PyThreadDetach between  - in
 // that case, don't create *new* PyThreadState but reuse!
-#ifndef NDEBUG
-#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7
-PyThreadState const*const current = _PyThreadState_UncheckedGet();
-// dereference isn't safe but let's hope it's tolerable for debugging 
purpose
-assert((current == nullptr || current->thread_id != 
PyThread_get_thread_ident()) && "recursive PyThreadAttach");
-#endif
-#endif
 tstate = PyGILState_GetThisThreadState(); // from TLS, possibly detached
 if (!tstate)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2020-01-08 Thread Michael Stahl (via logerrit)
 pyuno/source/module/pyuno_runtime.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 648fa0ab6bd5399422951f848ca86cb710b1bd52
Author: Michael Stahl 
AuthorDate: Wed Jan 8 10:31:37 2020 +0100
Commit: Michael Stahl 
CommitDate: Wed Jan 8 13:07:09 2020 +0100

pyuno: remove redundant if

Change-Id: Ie0359efa8777439818e357a14db3e2474e936ef6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86403
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index e0987cd63cd7..3e2bb0c6b0a6 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -1001,9 +1001,7 @@ PyThreadAttach::~PyThreadAttach()
 if (m_isNewState)
 {   // Clear needs GIL!
 PyThreadState_Clear( tstate );
-}
-if (m_isNewState)
-{   // note: PyThreadState_Delete(tstate) cannot be called, it will assert
+// note: PyThreadState_Delete(tstate) cannot be called, it will assert
 // because it requires a PyThreadState to be set, but not the tstate!
 PyThreadState_DeleteCurrent();
 }
@@ -1017,6 +1015,7 @@ PyThreadDetach::PyThreadDetach()
 {
 tstate = PyThreadState_Get();
 PyEval_ReleaseThread( tstate );
+// tstate must not be deleted here! lots of pointers to it on the stack
 }
 
 /** Acquires the global interpreter lock again
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2020-01-08 Thread Miklos Vajna (via logerrit)
 pyuno/source/module/pyuno_runtime.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit fb4e15a89d8d8f081c0c152e5047bc0e76870b39
Author: Miklos Vajna 
AuthorDate: Wed Jan 8 11:12:08 2020 +0100
Commit: Miklos Vajna 
CommitDate: Wed Jan 8 12:47:46 2020 +0100

pyuno: fix build against system-python-3.6

pyuno/source/module/pyuno_runtime.cxx:984:57: error: use of undeclared 
identifier 'PyThread_get_thread_ident'

It's only an assert, so simply do it only for >=3.7.

Change-Id: Ia3fffc7a9af30780adff9bc7dbabe1727c1f8f54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86410
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index 5fa923c236dc..e0987cd63cd7 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -979,9 +979,11 @@ PyThreadAttach::PyThreadAttach( PyInterpreterState *interp)
 // note: *may* be called recursively, with PyThreadDetach between  - in
 // that case, don't create *new* PyThreadState but reuse!
 #ifndef NDEBUG
+#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7
 PyThreadState const*const current = _PyThreadState_UncheckedGet();
 // dereference isn't safe but let's hope it's tolerable for debugging 
purpose
 assert((current == nullptr || current->thread_id != 
PyThread_get_thread_ident()) && "recursive PyThreadAttach");
+#endif
 #endif
 tstate = PyGILState_GetThisThreadState(); // from TLS, possibly detached
 if (!tstate)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2019-09-18 Thread Arkadiy Illarionov (via logerrit)
 pyuno/source/module/pyuno.cxx |   13 +
 pyuno/source/module/pyuno_adapter.cxx |2 +-
 pyuno/source/module/pyuno_impl.hxx|2 +-
 pyuno/source/module/pyuno_runtime.cxx |7 ++-
 4 files changed, 9 insertions(+), 15 deletions(-)

New commits:
commit 8e53efa926bc05d73c48579f63c3d662a96bd35e
Author: Arkadiy Illarionov 
AuthorDate: Wed Sep 18 00:18:33 2019 +0300
Commit: Arkadiy Illarionov 
CommitDate: Wed Sep 18 14:40:48 2019 +0200

tdf#39593 use getUnoTunnelImplementation in pyuno

Change-Id: I2cbbaad921b0a3d2ea6def4da2a2527dc4d94549
Reviewed-on: https://gerrit.libreoffice.org/79075
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov 

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index a4d0ddc4e314..d9c9dacbb3fd 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "pyuno_impl.hxx"
 
@@ -1711,14 +1712,10 @@ PyRef PyUNO_new (
 xInvocation.set(
 ssf->createInstanceWithArguments( Sequence( , 
1 ) ), css::uno::UNO_QUERY_THROW );
 
-Reference xUnoTunnel (
-
xInvocation->getIntrospection()->queryAdapter(cppu::UnoType::get()),
 UNO_QUERY );
-if( xUnoTunnel.is() )
-{
-sal_Int64 that = xUnoTunnel->getSomething( 
::pyuno::Adapter::getUnoTunnelImplementationId() );
-if( that )
-return reinterpret_cast(that)->getWrappedObject();
-}
+auto that = comphelper::getUnoTunnelImplementation(
+
xInvocation->getIntrospection()->queryAdapter(cppu::UnoType::get()));
+if( that )
+return that->getWrappedObject();
 }
 if( !Py_IsInitialized() )
 throw RuntimeException();
diff --git a/pyuno/source/module/pyuno_adapter.cxx 
b/pyuno/source/module/pyuno_adapter.cxx
index 1c392989d744..a8efd4153831 100644
--- a/pyuno/source/module/pyuno_adapter.cxx
+++ b/pyuno/source/module/pyuno_adapter.cxx
@@ -68,7 +68,7 @@ Adapter::~Adapter()
 
 static cppu::OImplementationId g_id( false );
 
-Sequence Adapter::getUnoTunnelImplementationId()
+Sequence Adapter::getUnoTunnelId()
 {
 return g_id.getImplementationId();
 }
diff --git a/pyuno/source/module/pyuno_impl.hxx 
b/pyuno/source/module/pyuno_impl.hxx
index 000f2660469d..91c24b4e7a88 100644
--- a/pyuno/source/module/pyuno_impl.hxx
+++ b/pyuno/source/module/pyuno_impl.hxx
@@ -347,7 +347,7 @@ public:
 Adapter( const PyRef ,
  const css::uno::Sequence< css::uno::Type > & types );
 
-static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
+static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
 const PyRef& getWrappedObject() const { return mWrappedObject; }
 const css::uno::Sequence< css::uno::Type >& getWrappedTypes() const { 
return mTypes; }
 virtual ~Adapter() override;
diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index d307f9af363c..62b3861288c3 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -832,11 +833,7 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum 
ConversionMode mode ) con
 if( adapterObject.is() )
 {
 // object got already bridged !
-Reference< css::lang::XUnoTunnel > tunnel( adapterObject, 
UNO_QUERY );
-
-Adapter *pAdapter = reinterpret_cast(
-tunnel->getSomething(
-::pyuno::Adapter::getUnoTunnelImplementationId() ) 
);
+auto pAdapter = 
comphelper::getUnoTunnelImplementation(adapterObject);
 
 mappedObject = impl->cargo->xAdapterFactory->createAdapter(
 adapterObject, pAdapter->getWrappedTypes() );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: pyuno/source

2019-07-26 Thread Andrea Gelmini (via logerrit)
 pyuno/source/module/unohelper.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ca3ddcf2cb8a7b69131a310621be18d044122a1c
Author: Andrea Gelmini 
AuthorDate: Tue Jul 23 19:38:58 2019 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jul 26 08:36:46 2019 +0200

Fix typo in code

Not tested with "make check", but for me cleary
a mistake.
I have "maybeambiguous" in the rest of the code,
but no "maybeambigous".

Change-Id: I327143b3e6e188fe661846f5d9b6d2806926d492
Reviewed-on: https://gerrit.libreoffice.org/76201
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/source/module/unohelper.py b/pyuno/source/module/unohelper.py
index a3e2141e7f84..cf6f78d63b32 100644
--- a/pyuno/source/module/unohelper.py
+++ b/pyuno/source/module/unohelper.py
@@ -58,7 +58,7 @@ def _propertymode_to_str( mode ):
 if PROP_ATTR_MAYBEDEFAULT & mode:
 ret = ret + "maybedefault "
 if PROP_ATTR_MAYBEAMBIGUOUS & mode:
-ret = ret + "maybeambigous "
+ret = ret + "maybeambiguous "
 if PROP_ATTR_READONLY & mode:
 ret = ret + "readonly "
 if PROP_ATTR_TRANSIENT & mode:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: pyuno/source

2019-06-10 Thread Stephan Bergmann (via logerrit)
 pyuno/source/module/pyuno.cxx  |9 -
 pyuno/source/module/pyuno_callable.cxx |9 -
 pyuno/source/module/pyuno_iterator.cxx |   18 --
 pyuno/source/module/pyuno_runtime.cxx  |9 -
 pyuno/source/module/pyuno_struct.cxx   |9 -
 5 files changed, 48 insertions(+), 6 deletions(-)

New commits:
commit 2bd585f31d7abb066e3f53d9b29c822af20aea69
Author: Stephan Bergmann 
AuthorDate: Fri Jun 7 15:57:13 2019 +0200
Commit: Caolán McNamara 
CommitDate: Mon Jun 10 21:10:56 2019 +0200

Adapt to upcoming Python 3.8

...which changed PyTypeObject in  "bpo-36974: implement PEP 590
(GH-13185)".

Change-Id: I687ec38aeda05d0747b9ed08221db75a758bed51
Reviewed-on: https://gerrit.libreoffice.org/73664
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index f5f23bf058fa..e59319030eb8 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -1636,7 +1636,11 @@ static PyTypeObject PyUNOType =
 sizeof (PyUNO),
 0,
 PyUNO_del,
-nullptr,
+#if PY_VERSION_HEX >= 0x0308
+0, // Py_ssize_t tp_vectorcall_offset
+#else
+nullptr, // printfunc tp_print
+#endif
 PyUNO_getattr,
 PyUNO_setattr,
 /* this type does not exist in Python 3: (cmpfunc) */ nullptr,
@@ -1680,6 +1684,9 @@ static PyTypeObject PyUNOType =
 , 0
 #if PY_VERSION_HEX >= 0x0304
 , nullptr
+#if PY_VERSION_HEX >= 0x0308
+, nullptr // vectorcallfunc tp_vectorcall
+#endif
 #endif
 };
 
diff --git a/pyuno/source/module/pyuno_callable.cxx 
b/pyuno/source/module/pyuno_callable.cxx
index 6519d20734c9..656d1c84cb0e 100644
--- a/pyuno/source/module/pyuno_callable.cxx
+++ b/pyuno/source/module/pyuno_callable.cxx
@@ -181,7 +181,11 @@ static PyTypeObject PyUNO_callable_Type =
 sizeof (PyUNO_callable),
 0,
 ::pyuno::PyUNO_callable_del,
-nullptr,
+#if PY_VERSION_HEX >= 0x0308
+0, // Py_ssize_t tp_vectorcall_offset
+#else
+nullptr, // printfunc tp_print
+#endif
 nullptr,
 nullptr,
 nullptr,
@@ -225,6 +229,9 @@ static PyTypeObject PyUNO_callable_Type =
 , 0
 #if PY_VERSION_HEX >= 0x0304
 , nullptr
+#if PY_VERSION_HEX >= 0x0308
+, nullptr // vectorcallfunc tp_vectorcall
+#endif
 #endif
 };
 
diff --git a/pyuno/source/module/pyuno_iterator.cxx 
b/pyuno/source/module/pyuno_iterator.cxx
index 5f643c13b67e..a7862857d719 100644
--- a/pyuno/source/module/pyuno_iterator.cxx
+++ b/pyuno/source/module/pyuno_iterator.cxx
@@ -118,7 +118,11 @@ static PyTypeObject PyUNO_iterator_Type =
 sizeof (PyUNO_iterator),
 0,
 PyUNO_iterator_del,
-nullptr,
+#if PY_VERSION_HEX >= 0x0308
+0, // Py_ssize_t tp_vectorcall_offset
+#else
+nullptr, // printfunc tp_print
+#endif
 nullptr,
 nullptr,
 nullptr,
@@ -162,6 +166,9 @@ static PyTypeObject PyUNO_iterator_Type =
 0
 #if PY_VERSION_HEX >= 0x0304
 , nullptr
+#if PY_VERSION_HEX >= 0x0308
+, nullptr // vectorcallfunc tp_vectorcall
+#endif
 #endif
 };
 
@@ -248,7 +255,11 @@ static PyTypeObject PyUNO_list_iterator_Type =
 sizeof (PyUNO_list_iterator),
  0,
 PyUNO_list_iterator_del,
-nullptr,
+#if PY_VERSION_HEX >= 0x0308
+0, // Py_ssize_t tp_vectorcall_offset
+#else
+nullptr, // printfunc tp_print
+#endif
 nullptr,
 nullptr,
 nullptr,
@@ -292,6 +303,9 @@ static PyTypeObject PyUNO_list_iterator_Type =
 0
 #if PY_VERSION_HEX >= 0x0304
 , nullptr
+#if PY_VERSION_HEX >= 0x0308
+, nullptr // vectorcallfunc tp_vectorcall
+#endif
 #endif
 };
 
diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index 9887c1fbc828..d307f9af363c 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -75,7 +75,11 @@ static PyTypeObject RuntimeImpl_Type =
 sizeof (RuntimeImpl),
 0,
 RuntimeImpl::del,
-nullptr,
+#if PY_VERSION_HEX >= 0x0308
+0, // Py_ssize_t tp_vectorcall_offset
+#else
+nullptr, // printfunc tp_print
+#endif
 nullptr,
 nullptr,
 nullptr,
@@ -119,6 +123,9 @@ static PyTypeObject RuntimeImpl_Type =
 , 0
 #if PY_VERSION_HEX >= 0x0304
 , nullptr
+#if PY_VERSION_HEX >= 0x0308
+, nullptr // vectorcallfunc tp_vectorcall
+#endif
 #endif
 };
 
diff --git a/pyuno/source/module/pyuno_struct.cxx 
b/pyuno/source/module/pyuno_struct.cxx
index 7088fc346145..9ad9439318ce 100644
--- a/pyuno/source/module/pyuno_struct.cxx
+++ b/pyuno/source/module/pyuno_struct.cxx
@@ -296,7 +296,11 @@ static PyTypeObject PyUNOStructType =
 sizeof (PyUNO),
 0,
 PyUNOStruct_del,
-nullptr,
+#if PY_VERSION_HEX >= 0x0308
+0, // Py_ssize_t tp_vectorcall_offset
+#else
+nullptr, // printfunc tp_print

[Libreoffice-commits] core.git: pyuno/source

2019-04-02 Thread Thomas Viehmann (via logerrit)
 pyuno/source/loader/pythonloader.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit dbbf20a4b40916ca4f5c98f18827ede39ad7a828
Author: Thomas Viehmann 
AuthorDate: Mon Apr 1 09:34:20 2019 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Tue Apr 2 09:22:03 2019 +0200

For Python extensions, set __file__ before executing the module

Previously __file__ was set after executing the module. This meant,
however that it was not available during execution.
This patch moves setting __file__ before the execution.

As __file__ is a string (and not bytes), we remove the encoding.

Change-Id: I63fe34b6f5d30f53aab16627d413c87b9de81992
Reviewed-on: https://gerrit.libreoffice.org/70048
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/pyuno/source/loader/pythonloader.py 
b/pyuno/source/loader/pythonloader.py
index ddb9001fc0e6..268cb168fe3c 100644
--- a/pyuno/source/loader/pythonloader.py
+++ b/pyuno/source/loader/pythonloader.py
@@ -100,8 +100,8 @@ class Loader( XImplementationLoader, XServiceInfo, 
unohelper.Base ):
 
 # compile and execute the module
 codeobject = compile( src, encfile(filename), "exec" )
+mod.__file__ = filename
 exec(codeobject, mod.__dict__)
-mod.__file__ = encfile(filename)
 g_loadedComponents[url] = mod
 return mod
 elif "vnd.openoffice.pymodule" == protocol:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: pyuno/source

2018-10-31 Thread Libreoffice Gerrit user
 pyuno/source/module/pyuno_type.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 485ec8e14306352f44056bcb644bb4cacdb6490a
Author: Noel Grandin 
AuthorDate: Wed Oct 31 13:31:55 2018 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 1 06:43:41 2018 +0100

fix pyuno compile on Fedora29

'PyUnicode_GetSize' is deprecated [-Werror,-Wdeprecated-declarations]

Change-Id: Id298d6a2b0af9ce418f9124c9addda55fcdc0318
Reviewed-on: https://gerrit.libreoffice.org/62687
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/pyuno/source/module/pyuno_type.cxx 
b/pyuno/source/module/pyuno_type.cxx
index 80505d85bbd1..fc6385e2be1b 100644
--- a/pyuno/source/module/pyuno_type.cxx
+++ b/pyuno/source/module/pyuno_type.cxx
@@ -135,7 +135,11 @@ sal_Unicode PyChar2Unicode( PyObject *obj )
 "attribute value of uno.Char is not a unicode string" );
 }
 
+#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3
+if( PyUnicode_GetLength( value.get() ) < 1 )
+#else
 if( PyUnicode_GetSize( value.get() ) < 1 )
+#endif
 {
 throw RuntimeException(
 "uno.Char contains an empty unicode string");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source reportdesign/source sax/qa svx/source test/source

2018-10-12 Thread Libreoffice Gerrit user
 pyuno/source/module/pyuno.cxx   |   24 
 pyuno/source/module/pyuno_iterator.cxx  |2 +-
 reportdesign/source/filter/xml/xmlTable.cxx |2 +-
 sax/qa/cppunit/xmlimport.cxx|2 +-
 svx/source/dialog/SafeModeDialog.cxx|4 ++--
 test/source/unoapi_property_testers.cxx |4 ++--
 6 files changed, 19 insertions(+), 19 deletions(-)

New commits:
commit fa394eef4017d62549599ded3a62d790bc508582
Author: Noel Grandin 
AuthorDate: Thu Oct 11 16:36:57 2018 +0200
Commit: Noel Grandin 
CommitDate: Fri Oct 12 08:54:15 2018 +0200

clang-tidy misc-throw-by-value-catch-by-reference

Change-Id: I04750771b63551fd3df522753a4ed21b8d5c42f3
Reviewed-on: https://gerrit.libreoffice.org/61680
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 434888f59e6e..a581d8335d76 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -871,11 +871,11 @@ static PyObject* PyUNO_getitem( PyObject *self, PyObject 
*pKey )
 
 PyErr_SetString( PyExc_TypeError, "object is not subscriptable" );
 }
-catch( const css::lang::IndexOutOfBoundsException )
+catch( const css::lang::IndexOutOfBoundsException & )
 {
 PyErr_SetString( PyExc_IndexError, "index out of range" );
 }
-catch( const css::container::NoSuchElementException )
+catch( const css::container::NoSuchElementException & )
 {
 PyErr_SetString( PyExc_KeyError, "key not found" );
 }
@@ -920,7 +920,7 @@ static int lcl_setitem_index( PyUNO const *me, PyObject 
*pKey, PyObject *pValue
 {
 aValue = runtime.pyObject2Any( pValue );
 }
-catch ( const css::uno::RuntimeException )
+catch ( const css::uno::RuntimeException & )
 {
 // TODO pyObject2Any can't convert e.g. dicts but only throws
 // RuntimeException on failure. Fixing this will require an audit 
of
@@ -1041,7 +1041,7 @@ static int lcl_setitem_slice( PyUNO const *me, PyObject 
*pKey, PyObject *pValue
 {
 aItem = runtime.pyObject2Any( rItem.get() );
 }
-catch ( const css::uno::RuntimeException )
+catch ( const css::uno::RuntimeException & )
 {
 // TODO pyObject2Any can't convert e.g. dicts but only 
throws
 // RuntimeException on failure. Fixing this will require 
an audit of
@@ -1100,7 +1100,7 @@ static int lcl_setitem_string( PyUNO const *me, PyObject 
*pKey, PyObject *pValue
 {
 aValue = runtime.pyObject2Any( pValue );
 }
-catch( const css::uno::RuntimeException )
+catch( const css::uno::RuntimeException & )
 {
 // TODO pyObject2Any can't convert e.g. dicts but only throws
 // RuntimeException on failure. Fixing this will require an audit 
of
@@ -1136,7 +1136,7 @@ static int lcl_setitem_string( PyUNO const *me, PyObject 
*pKey, PyObject *pValue
 xNameContainer->insertByName( sKey, aValue );
 return 0;
 }
-catch( css::container::ElementExistException )
+catch( const css::container::ElementExistException & )
 {
 // Fall through, try replace instead
 }
@@ -1178,19 +1178,19 @@ static int PyUNO_setitem( PyObject *self, PyObject 
*pKey, PyObject *pValue )
 
 PyErr_SetString( PyExc_TypeError, "list index has invalid type" );
 }
-catch( const css::lang::IndexOutOfBoundsException )
+catch( const css::lang::IndexOutOfBoundsException & )
 {
 PyErr_SetString( PyExc_IndexError, "list index out of range" );
 }
-catch( const css::container::NoSuchElementException )
+catch( const css::container::NoSuchElementException & )
 {
 PyErr_SetString( PyExc_KeyError, "key not found" );
 }
-catch( const css::lang::IllegalArgumentException )
+catch( const css::lang::IllegalArgumentException & )
 {
 PyErr_SetString( PyExc_TypeError, "value has invalid type" );
 }
-catch( css::script::CannotConvertException )
+catch( const css::script::CannotConvertException & )
 {
 PyErr_SetString( PyExc_TypeError, "value has invalid type" );
 }
@@ -1299,7 +1299,7 @@ static int PyUNO_contains( PyObject *self, PyObject *pKey 
)
 {
 aValue = runtime.pyObject2Any( pKey );
 }
-catch( const css::uno::RuntimeException )
+catch( const css::uno::RuntimeException & )
 {
 // TODO pyObject2Any can't convert e.g. dicts but only throws
 // RuntimeException on failure. Fixing this will require an audit 
of
@@ -1347,7 +1347,7 @@ static int PyUNO_contains( PyObject *self, PyObject *pKey 
)
 
   

[Libreoffice-commits] core.git: pyuno/source

2018-07-03 Thread Stephan Bergmann
 pyuno/source/module/pyuno_impl.hxx |2 +-
 pyuno/source/module/pyuno_type.cxx |2 +-
 pyuno/source/module/pyuno_util.cxx |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 76a29148be63cb006a7e25e312dc93acc93e071f
Author: Stephan Bergmann 
Date:   Tue Jul 3 08:33:34 2018 +0200

const fixes for python3-devel-3.7.0-1.fc29.x86_64

Change-Id: Ia16a8b828e11ce36e9bb77ecf9e8a1179bd9b90c
Reviewed-on: https://gerrit.libreoffice.org/56841
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/source/module/pyuno_impl.hxx 
b/pyuno/source/module/pyuno_impl.hxx
index ea0e419ffb1b..73acabdf4a16 100644
--- a/pyuno/source/module/pyuno_impl.hxx
+++ b/pyuno/source/module/pyuno_impl.hxx
@@ -80,7 +80,7 @@ inline PyObject* PyStr_FromString(const char *string)
 return PyUnicode_FromString(string);
 }
 
-inline char * PyStr_AsString(PyObject *object)
+inline char const * PyStr_AsString(PyObject *object)
 {
 return PyUnicode_AsUTF8(object);
 }
diff --git a/pyuno/source/module/pyuno_type.cxx 
b/pyuno/source/module/pyuno_type.cxx
index c6fc1351436b..80505d85bbd1 100644
--- a/pyuno/source/module/pyuno_type.cxx
+++ b/pyuno/source/module/pyuno_type.cxx
@@ -157,7 +157,7 @@ Any PyEnum2Enum( PyObject *obj )
 }
 
 OUString strTypeName( OUString::createFromAscii( PyStr_AsString( 
typeName.get() ) ) );
-char *stringValue = PyStr_AsString( value.get() );
+char const *stringValue = PyStr_AsString( value.get() );
 
 TypeDescription desc( strTypeName );
 if( !desc.is() )
diff --git a/pyuno/source/module/pyuno_util.cxx 
b/pyuno/source/module/pyuno_util.cxx
index 45ee5a38e40b..f9714fb270f0 100644
--- a/pyuno/source/module/pyuno_util.cxx
+++ b/pyuno/source/module/pyuno_util.cxx
@@ -69,7 +69,7 @@ OUString pyString2ustring( PyObject *pystr )
 #else
 #if PY_MAJOR_VERSION >= 3
 Py_ssize_t size(0);
-char *pUtf8(PyUnicode_AsUTF8AndSize(pystr, ));
+char const *pUtf8(PyUnicode_AsUTF8AndSize(pystr, ));
 ret = OUString(pUtf8, size, RTL_TEXTENCODING_UTF8);
 #else
 PyObject* pUtf8 = PyUnicode_AsUTF8String(pystr);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2018-06-23 Thread Tor Lillqvist
 pyuno/source/module/pyuno_module.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit 03c14b836ab03735870b36c2388fd88782b97550
Author: Tor Lillqvist 
Date:   Wed Jun 20 17:50:54 2018 +0300

[API CHANGE] Add a sal_debug method to pyuno

Does the obvious thing. Useful to get debug output from Python code at
development time into the same format and in the same output file as
from SAL_DEBUG() calls in C++ source code. Especially useful when
combined with SAL_LOG=+TIMESTAMP or +RELATIVETIMER.

Change-Id: I8c3d4fdf83b06846acb56773438401d467e71062
Reviewed-on: https://gerrit.libreoffice.org/56171
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/pyuno/source/module/pyuno_module.cxx 
b/pyuno/source/module/pyuno_module.cxx
index a50ca379cf9a..9fe1f07f30b6 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -823,6 +823,20 @@ static PyObject *setCurrentContext(
 return ret.getAcquired();
 }
 
+static PyObject *sal_debug(
+SAL_UNUSED_PARAMETER PyObject *, SAL_UNUSED_PARAMETER PyObject * args )
+{
+Py_INCREF( Py_None );
+if( !PyTuple_Check( args ) || PyTuple_Size( args) != 1 )
+return Py_None;
+
+OUString line = pyString2ustring( PyTuple_GetItem( args, 0 ) );
+
+SAL_DEBUG(line.toUtf8().getStr());
+
+return Py_None;
+}
+
 }
 
 struct PyMethodDef PyUNOModule_methods [] =
@@ -843,6 +857,7 @@ struct PyMethodDef PyUNOModule_methods [] =
 {"invoke", invoke, METH_VARARGS | METH_KEYWORDS, nullptr},
 {"setCurrentContext", setCurrentContext, METH_VARARGS, nullptr},
 {"getCurrentContext", getCurrentContext, METH_VARARGS, nullptr},
+{"sal_debug", sal_debug, METH_VARARGS, nullptr},
 {nullptr, nullptr, 0, nullptr}
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2018-02-01 Thread Michael Stahl
 pyuno/source/loader/pyuno_loader.cxx |   20 
 1 file changed, 16 insertions(+), 4 deletions(-)

New commits:
commit 5357ca82846ea7147ad61e9340f25647a5934eb0
Author: Michael Stahl 
Date:   Thu Feb 1 13:52:00 2018 +0100

tdf#114815 pyuno: avoid 2 threads initing python in parallel

According to the crash reports, it's possible for the grammar checking
thread to call GetGrammarChecker, instantiating lightproof, at the same
time as the main thread instantiates LngSvcMgr, which also instantiates
(some?) (all?) grammar checkers.

Ensure that pyuno_loader::CreateInstance() initialises Python only
once with a C++11 thread safe static.

Change-Id: I5b1faba9107355c508831a078366e4a29fdbfadf

diff --git a/pyuno/source/loader/pyuno_loader.cxx 
b/pyuno/source/loader/pyuno_loader.cxx
index 559dc64d1d99..31b4f8f494f9 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -176,11 +176,10 @@ static void prependPythonPath( const OUString & 
pythonPathBootstrap )
 osl_setEnvironment(envVar.pData, envValue.pData);
 }
 
-Reference< XInterface > CreateInstance( const Reference< XComponentContext > & 
ctx )
+struct PythonInit
 {
-Reference< XInterface > ret;
-
-if( ! Py_IsInitialized() )
+PythonInit() {
+if (! Py_IsInitialized()) // may be inited by getComponentContext() already
 {
 OUString pythonPath;
 OUString pythonHome;
@@ -236,9 +235,22 @@ Reference< XInterface > CreateInstance( const Reference< 
XComponentContext > & c
 // PyThreadAttach below.
 PyThreadState_Delete(tstate);
 }
+}
+};
+
+Reference CreateInstance(const Reference & ctx)
+{
+// tdf#114815 thread-safe static to init python only once
+static PythonInit s_Init;
+
+Reference< XInterface > ret;
 
 PyThreadAttach attach( PyInterpreterState_Head() );
 {
+// note: this can't race against getComponentContext() because
+// either (in soffice.bin) CreateInstance() must be called before
+// getComponentContext() can be called, or (in python.bin) the other
+// way around
 if( ! Runtime::isInitialized() )
 {
 Runtime::initialize( ctx );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2017-11-04 Thread Julien Nabet
 pyuno/source/module/pyuno_runtime.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit a64c741f20dc3fcc8c47762b6cfe7f8551557394
Author: Julien Nabet 
Date:   Sat Nov 4 15:08:25 2017 +0100

Replace only list by vector in pyuno

Change-Id: Ic770d1fb8e3735123786a73a7b57f71ad8005d5d
Reviewed-on: https://gerrit.libreoffice.org/44301
Reviewed-by: Noel Grandin 
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 

diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index 0955326f61fc..172c0313fd9e 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -31,7 +31,6 @@
 #include 
 #include 
 
-#include 
 #include 
 
 #include 
@@ -609,7 +608,7 @@ bool Runtime::pyIterUnpack( PyObject *const pObj, Any  ) 
const
 return true;
 }
 
-::std::list items;
+::std::vector items;
 do
 {
 PyRef rItem( pItem, SAL_NO_ACQUIRE );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2017-10-03 Thread Mike Kaganski
 pyuno/source/module/pyuno_util.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 419ae5765ac562982f843adbfff32154e2559162
Author: Mike Kaganski 
Date:   Tue Oct 3 11:01:18 2017 +0200

Partially revert c3609f107b16eb888edf284f4637be6cb09234eb

Change-Id: I92c84d0d0fba1adcd0adfc93e3fe9b5ea6b8cbf2
Reviewed-on: https://gerrit.libreoffice.org/43065
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 

diff --git a/pyuno/source/module/pyuno_util.cxx 
b/pyuno/source/module/pyuno_util.cxx
index 055ef736695b..e92dad2e8bca 100644
--- a/pyuno/source/module/pyuno_util.cxx
+++ b/pyuno/source/module/pyuno_util.cxx
@@ -43,7 +43,7 @@ PyRef ustring2PyUnicode( const OUString & str )
 ret = PyRef( PyUnicode_FromUnicode( reinterpret_cast(str.getStr()), str.getLength() ), SAL_NO_ACQUIRE );
 #else
 static_assert(sizeof (wchar_t) == Py_UNICODE_SIZE, "bad assumption");
-ret = PyRef( PyUnicode_FromUnicode( SAL_W(str.getStr()), str.getLength() 
), SAL_NO_ACQUIRE );
+ret = PyRef( PyUnicode_FromUnicode( reinterpret_cast(str.getStr()), str.getLength() ), SAL_NO_ACQUIRE );
 #endif
 #else
 OString sUtf8(OUStringToOString(str, RTL_TEXTENCODING_UTF8));
@@ -64,7 +64,8 @@ OUString pyString2ustring( PyObject *pystr )
 if( PyUnicode_Check( pystr ) )
 {
 #if Py_UNICODE_SIZE == 2
-ret = SAL_U(PyUnicode_AS_UNICODE( pystr ));
+ret = OUString(
+reinterpret_cast(PyUnicode_AS_UNICODE( pystr )) );
 #else
 #if PY_MAJOR_VERSION >= 3
 Py_ssize_t size(0);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2017-09-25 Thread Muhammet Kara
 pyuno/source/module/pyuno_adapter.cxx |   28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 7810858ee6cac233ce5868de1f2ef5de1d443af4
Author: Muhammet Kara 
Date:   Sun Sep 24 21:14:44 2017 +

tdf#57950: Replace chained OUStringBuffer::append() with operator+

Change-Id: Ibf9d3b24b0caa6b84f403d7bbbc90912fe64a559
Reviewed-on: https://gerrit.libreoffice.org/42728
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/pyuno/source/module/pyuno_adapter.cxx 
b/pyuno/source/module/pyuno_adapter.cxx
index 52f7577c550b..ebb6204bb7ea 100644
--- a/pyuno/source/module/pyuno_adapter.cxx
+++ b/pyuno/source/module/pyuno_adapter.cxx
@@ -238,12 +238,13 @@ Any Adapter::invoke( const OUString ,
 raiseInvocationTargetExceptionWhenNeeded( runtime);
 if( !method.is() )
 {
-OUStringBuffer buf;
-buf.append( "pyuno::Adapter: Method " ).append( aFunctionName );
-buf.append( " is not implemented at object " );
 PyRef str( PyObject_Repr( mWrappedObject.get() ), SAL_NO_ACQUIRE );
-buf.append(pyString2ustring(str.get()));
-throw IllegalArgumentException( buf.makeStringAndClear(), 
Reference< XInterface > (),0 );
+
+OUString sMsg = "pyuno::Adapter: Method "
+  + aFunctionName
+  + " is not implemented at object "
+  + pyString2ustring(str.get());
+throw IllegalArgumentException( sMsg, Reference< XInterface > (),0 
);
 }
 
 PyRef pyRet( PyObject_CallObject( method.get(), argsTuple.get() ), 
SAL_NO_ACQUIRE );
@@ -276,15 +277,14 @@ Any Adapter::invoke( const OUString ,
 
 if( aOutParamIndex.getLength() +1 != seq.getLength() )
 {
-OUStringBuffer buf;
-buf.append( "pyuno bridge: expected for method " );
-buf.append( aFunctionName );
-buf.append( " one return value and " );
-buf.append( aOutParamIndex.getLength() );
-buf.append( " out parameters, got a sequence of " );
-buf.append( seq.getLength() );
-buf.append( " elements as return value." );
-throw RuntimeException(buf.makeStringAndClear(), *this 
);
+OUString sMsg = "pyuno bridge: expected for method "
+  + aFunctionName
+  + " one return value and "
+  + 
OUString::number(aOutParamIndex.getLength())
+  + " out parameters, got a sequence of "
+  + OUString::number(seq.getLength())
+  + " elements as return value.";
+throw RuntimeException( sMsg, *this );
 }
 
 aOutParam.realloc( aOutParamIndex.getLength() );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2017-05-12 Thread Stephan Bergmann
 pyuno/source/module/pyuno_util.cxx |   22 +-
 1 file changed, 5 insertions(+), 17 deletions(-)

New commits:
commit 3e78796433c40a99b6d95b0bcde844e0b1d2dc5f
Author: Stephan Bergmann 
Date:   Fri May 12 13:26:15 2017 +0200

Clean up uses of SAL_U/SAL_W: pyuno

...and clean up MACOSX specific code

Change-Id: I1796b4b8f2695359557a5374b5d7592ccf8f86a6

diff --git a/pyuno/source/module/pyuno_util.cxx 
b/pyuno/source/module/pyuno_util.cxx
index 30e636ffe2a2..aecca4ad2eae 100644
--- a/pyuno/source/module/pyuno_util.cxx
+++ b/pyuno/source/module/pyuno_util.cxx
@@ -39,16 +39,11 @@ PyRef ustring2PyUnicode( const OUString & str )
 {
 PyRef ret;
 #if Py_UNICODE_SIZE == 2
-// YD force conversion since python/2 uses wchar_t
 #ifdef MACOSX
-// on Sierra, python 2.7 (builtin)
-// no known conversion from 'const sal_Unicode *' (aka 'const char16_t *') 
to
-// 'const Py_UNICODE *' (aka 'const unsigned short *')
-// An explicit cast to sal_Unicode does not work
-// Hack to avoid that error
-ret = PyRef( PyUnicode_FromUnicode( (const unsigned short *)str.getStr(), 
str.getLength() ), SAL_NO_ACQUIRE );
+ret = PyRef( PyUnicode_FromUnicode( reinterpret_cast(str.getStr()), str.getLength() ), SAL_NO_ACQUIRE );
 #else
-ret = PyRef( PyUnicode_FromUnicode( SAL_W(str.getStr()), str.getLength() 
), SAL_NO_ACQUIRE );
+static_assert(sizeof (wchar_t) == Py_UNICODE_SIZE, "bad assumption");
+ret = PyRef( PyUnicode_FromUnicode( reinterpret_cast(str.getStr()), str.getLength() ), SAL_NO_ACQUIRE );
 #endif
 #else
 OString sUtf8(OUStringToOString(str, RTL_TEXTENCODING_UTF8));
@@ -69,15 +64,8 @@ OUString pyString2ustring( PyObject *pystr )
 if( PyUnicode_Check( pystr ) )
 {
 #if Py_UNICODE_SIZE == 2
-#ifdef MACOSX
-// on Sierra, python 2.7 (builtin)
-// no known conversion from 'Py_UNICODE *' (aka 'unsigned short *') to
-// 'sal_Unicode' (aka 'char16_t') for 1st argument
-// Hack to avoid that error
-ret = OUString( (sal_Unicode *)PyUnicode_AS_UNICODE( pystr ) );
-#else
-ret = OUString( SAL_U(PyUnicode_AS_UNICODE( pystr )) );
-#endif
+ret = OUString(
+reinterpret_cast(PyUnicode_AS_UNICODE( pystr )) );
 #else
 #if PY_MAJOR_VERSION >= 3
 Py_ssize_t size(0);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source qadevOOo/runner qadevOOo/tests reportbuilder/java reportdesign/source rsc/inc

2017-03-02 Thread Andrea Gelmini
 pyuno/source/module/pyuno_runtime.cxx |
2 +-
 qadevOOo/runner/helper/ContextMenuInterceptor.java|
8 
 qadevOOo/tests/java/ifc/awt/_XControl.java|
2 +-
 qadevOOo/tests/java/ifc/lang/_XInitialization.java|
2 +-
 qadevOOo/tests/java/ifc/sdbcx/_XDataDefinitionSupplier.java   |
2 +-
 qadevOOo/tests/java/ifc/ucb/_XPropertyMatcherFactory.java |
2 +-
 qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewHeaderCell.java|
2 +-
 qadevOOo/tests/java/mod/_sw/SwAccessibleDocumentPageView.java |
4 ++--
 reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java |
2 +-
 reportdesign/source/ui/inc/UITools.hxx|
2 +-
 rsc/inc/rsctop.hxx|
2 +-
 11 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit b068d9fb8d29e06ff652b1493605cea22a9199f3
Author: Andrea Gelmini 
Date:   Thu Mar 2 12:23:08 2017 +0100

Fix typos

Change-Id: I35eeb71f4f698e39b7b0d98e3cb30657a64a611a
Reviewed-on: https://gerrit.libreoffice.org/34802
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index 0238c58..4f922d2 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -501,7 +501,7 @@ PyRef Runtime::any2PyObject (const Any  ) const
 Sequence< sal_Int8 > byteSequence;
 if( a >>= byteSequence )
 {
-// byte sequence is treated in a special way because of peformance 
reasons
+// byte sequence is treated in a special way because of 
performance reasons
 // @since 0.9.2
 return PyRef( PyUNO_ByteSequence_new( byteSequence, *this ), 
SAL_NO_ACQUIRE );
 }
diff --git a/qadevOOo/runner/helper/ContextMenuInterceptor.java 
b/qadevOOo/runner/helper/ContextMenuInterceptor.java
index be21ff7..e046286 100644
--- a/qadevOOo/runner/helper/ContextMenuInterceptor.java
+++ b/qadevOOo/runner/helper/ContextMenuInterceptor.java
@@ -62,14 +62,14 @@ public class ContextMenuInterceptor implements 
XContextMenuInterceptor {
 XIndexContainer.class,
 
xMenuElementFactory.createInstance("com.sun.star.ui.ActionTriggerContainer" ));
 
-// intialize root menu entry "Help"
+// initialize root menu entry "Help"
 xRootMenuEntry.setPropertyValue( "Text", "Help" );
 xRootMenuEntry.setPropertyValue( "CommandURL", "slot:5410" );
 xRootMenuEntry.setPropertyValue( "HelpURL", "5410" );
 xRootMenuEntry.setPropertyValue( "SubContainer", 
xSubMenuContainer );
 
 // create menu entries for the new sub menu
-// intialize help/content menu entry
+// initialize help/content menu entry
 // entry "Content"
 XPropertySet xMenuEntry = UnoRuntime.queryInterface(
 XPropertySet.class, xMenuElementFactory.createInstance(
@@ -81,7 +81,7 @@ public class ContextMenuInterceptor implements 
XContextMenuInterceptor {
 // insert menu entry to sub menu
 xSubMenuContainer.insertByIndex( 0, xMenuEntry );
 
-// intialize help/help on help
+// initialize help/help on help
 // entry "Help on Help"
 xMenuEntry = UnoRuntime.queryInterface(
 XPropertySet.class,
@@ -92,7 +92,7 @@ public class ContextMenuInterceptor implements 
XContextMenuInterceptor {
 
 // insert menu entry to sub menu
 xSubMenuContainer.insertByIndex( 1, xMenuEntry );
-// intialize help/tips
+// initialize help/tips
 // entry "Tips"
 xMenuEntry = UnoRuntime.queryInterface(
 XPropertySet.class,
diff --git a/qadevOOo/tests/java/ifc/awt/_XControl.java 
b/qadevOOo/tests/java/ifc/awt/_XControl.java
index 0f3c06a..ffb9bcb 100644
--- a/qadevOOo/tests/java/ifc/awt/_XControl.java
+++ b/qadevOOo/tests/java/ifc/awt/_XControl.java
@@ -171,7 +171,7 @@ public class _XControl extends MultiMethodTest {
 
 /**
 * Test calls the method. Then mode is checked using isDesignMode().
-* Has  OK  status if mode is swithed.
+* Has  OK  status if mode is switched.
 */
 public void _setDesignMode() {
 desMode = oObj.isDesignMode();
diff --git a/qadevOOo/tests/java/ifc/lang/_XInitialization.java 
b/qadevOOo/tests/java/ifc/lang/_XInitialization.java
index ba2150b..5566aef 100644
--- a/qadevOOo/tests/java/ifc/lang/_XInitialization.java
+++ 

[Libreoffice-commits] core.git: pyuno/source

2016-07-14 Thread Kenneth Koski
 pyuno/source/module/uno.py |  619 ++---
 1 file changed, 367 insertions(+), 252 deletions(-)

New commits:
commit deb989dd6d1f86e74864131be50ed92d8d43768c
Author: Kenneth Koski 
Date:   Mon Feb 29 22:22:10 2016 -0600

Improving uno.py code style

* Fixing pep8 violations
* Improving comments, docstrings, and unifying coding style
* Using functionality copied from six library for Python 2/3 compatibility
* Using standard traceback formatting

Change-Id: I62bd0e8513ffc59202163002fa4adea3d92572c3
Reviewed-on: https://gerrit.libreoffice.org/22848
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/pyuno/source/module/uno.py b/pyuno/source/module/uno.py
index 1526aac..29cc684 100644
--- a/pyuno/source/module/uno.py
+++ b/pyuno/source/module/uno.py
@@ -16,208 +16,278 @@
 #   except in compliance with the License. You may obtain a copy of
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
+import pyuno
 import sys
+import traceback
+import warnings
 
-import pyuno
+# since on Windows sal3.dll no longer calls WSAStartup
+import socket
 
-try:
-import __builtin__
-except ImportError:
-import builtins as __builtin__
+# Some Python 2/3 compatibility code copied from the six library
+PY2 = sys.version_info[0] == 2
 
-try:
-unicode
-except NameError:
-# Python 3 compatibility
-unicode = str
+if PY2:
+six_string_types = basestring,
+else:
+six_string_types = str,
 
-import socket # since on Windows sal3.dll no longer calls WSAStartup
+# All functions and variables starting with a underscore (_) must be
+# considered private and can be changed at any time. Don't use them.
+_component_context = pyuno.getComponentContext()
 
-# all functions and variables starting with a underscore (_) must be 
considered private
-# and can be changed at any time. Don't use them
-_g_ctx = pyuno.getComponentContext( )
-_g_delegatee = __builtin__.__dict__["__import__"]
 
 def getComponentContext():
-""" returns the UNO component context, that was used to initialize the 
python runtime.
+"""Returns the UNO component context used to initialize the Python 
runtime."""
+
+return _component_context
+
+
+def getCurrentContext():
+"""Returns the current context.
+
+See 
http://udk.openoffice.org/common/man/concept/uno_contexts.html#current_context
+for an explanation on the current context concept.
 """
-return _g_ctx
 
-def getConstantByName( constant ):
-"Looks up the value of a idl constant by giving its explicit name"
-return pyuno.getConstantByName( constant )
+return pyuno.getCurrentContext()
+
 
-def getTypeByName( typeName):
-""" returns a uno.Type instance of the type given by typeName. In case the
-type does not exist, a com.sun.star.uno.RuntimeException is raised.
+def setCurrentContext(newContext):
+"""Sets newContext as new UNO context.
+
+The newContext must implement the XCurrentContext interface. The
+implementation should handle the desired properties and delegate
+unknown properties to the old context. Ensure that the old one
+is reset when you leave your stack, see
+
http://udk.openoffice.org/common/man/concept/uno_contexts.html#current_context
 """
-return pyuno.getTypeByName( typeName )
 
-def createUnoStruct( typeName, *args, **kwargs ):
-"""creates a uno struct or exception given by typeName. Can be called with:
+return pyuno.setCurrentContext(newContext)
+
+
+def getConstantByName(constant):
+"""Looks up the value of an IDL constant by giving its explicit name."""
+
+return pyuno.getConstantByName(constant)
+
+
+def getTypeByName(typeName):
+"""Returns a `uno.Type` instance of the type given by typeName.
+
+If the type does not exist, a `com.sun.star.uno.RuntimeException` is 
raised.
+"""
+
+return pyuno.getTypeByName(typeName)
+
+
+def createUnoStruct(typeName, *args, **kwargs):
+"""Creates a UNO struct or exception given by typeName.
+
+Can be called with:
+
 1) No additional argument.
-   In this case, you get a default constructed uno structure.
-   ( e.g. createUnoStruct( "com.sun.star.uno.Exception" ) )
+   In this case, you get a default constructed UNO structure.
+   (e.g. `createUnoStruct("com.sun.star.uno.Exception")`)
 2) Exactly one additional argument that is an instance of typeName.
In this case, a copy constructed instance of typeName is returned
-   ( e.g. createUnoStruct( "com.sun.star.uno.Exception" , e ) )
+   (e.g. `createUnoStruct("com.sun.star.uno.Exception" , e)`)
 3) As many additional arguments as the number of elements within typeName
-   (e.g. createUnoStruct( "com.sun.star.uno.Exception", "foo error" , 
self) ).
+   (e.g. `createUnoStruct("com.sun.star.uno.Exception", "foo 

[Libreoffice-commits] core.git: pyuno/source

2016-05-09 Thread Luke Deller
 pyuno/source/module/pyuno_runtime.cxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit f4604e43a653a067633c24e069b272b6309b2151
Author: Luke Deller 
Date:   Sun May 8 20:58:33 2016 +1000

Fix call to deleted Any constructor

A recent commit 6e70103d deleted some Any constructors and methods, and
updated all the places where these had been called - except it looks
like one call was missed, active only when building against Python 2.

Adjust this call following what was done for the Python 3 case.

Change-Id: I0f92b7476b617d9fdf0e5f698e363360497d115e
Reviewed-on: https://gerrit.libreoffice.org/24759
Tested-by: Jenkins 
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index 0669360..468d21f 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -658,13 +658,11 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum 
ConversionMode mode ) con
 {
 if( o == Py_True )
 {
-sal_Bool b = sal_True;
-a = Any( , cppu::UnoType::get() );
+a <<= true;
 }
 else if ( o == Py_False )
 {
-sal_Bool b = sal_False;
-a = Any( , cppu::UnoType::get() );
+a <<= false;
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2016-03-04 Thread Tomáš Chvátal
 pyuno/source/module/uno.py |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit a4c17041271eca2181cf11e5a0b59f4001c20cee
Author: Tomáš Chvátal 
Date:   Thu Mar 3 13:55:34 2016 +0100

Fix python2 build of pyuno with older py2 versions

SyntaxError: ('invalid syntax', ('//usr/lib64/libreoffice/program//uno.py',
368, 77, "return _ConstantGroup({c.Name.split('.')[-1]:
c.ConstantValue for c in td.Constants})\n"))

Change-Id: Ie87c21fbfd83fc4d6f918eb55128db235c2220a8
Reviewed-on: https://gerrit.libreoffice.org/22863
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/pyuno/source/module/uno.py b/pyuno/source/module/uno.py
index a899c70..1526aac 100644
--- a/pyuno/source/module/uno.py
+++ b/pyuno/source/module/uno.py
@@ -361,7 +361,10 @@ def _impl_getConstantGroupByName( module, group ):
 qualifiedName = module + '.' + group
 for td in tde:
 if td.Name == qualifiedName:
-return _ConstantGroup({c.Name.split('.')[-1]: c.ConstantValue for 
c in td.Constants})
+return_dict = dict()
+for c in td.Constants:
+return_dict.update({c.Name.split('.')[-1]: c.ConstantValue})
+return _ConstantGroup(return_dict)
 else:
 raise ValueError
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2016-02-09 Thread Rico Tzschichholz
 pyuno/source/module/pyuno.cxx  |2 +-
 pyuno/source/module/pyuno_impl.hxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e14bd2d6845cf13a35b14762d6e1e160e8315997
Author: Rico Tzschichholz 
Date:   Tue Feb 9 12:55:24 2016 +0100

pyuno: Fix build with python 2.7

Adjust conditionals to properly respect python 2.7.1+

Change-Id: I32d21a071e054100294e418af5358305eac69944
Reviewed-on: https://gerrit.libreoffice.org/22231
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index d69f195..8b44c64 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -324,7 +324,7 @@ sal_Int32 lcl_PyNumber_AsSal_Int32( PyObject *pObj )
 
 // Convert Python number to platform long, then check actual value against
 // bounds of sal_Int32
-#if PY_VERSION_HEX >= 0x0207
+#if PY_VERSION_HEX >= 0x0302
 int nOverflow;
 long nResult = PyLong_AsLongAndOverflow( pObj,  );
 if ( nOverflow || nResult > SAL_MAX_INT32 || nResult < SAL_MIN_INT32) {
diff --git a/pyuno/source/module/pyuno_impl.hxx 
b/pyuno/source/module/pyuno_impl.hxx
index 39a0952..69e254c 100644
--- a/pyuno/source/module/pyuno_impl.hxx
+++ b/pyuno/source/module/pyuno_impl.hxx
@@ -26,7 +26,7 @@
 
 #include 
 
-#if PY_VERSION_HEX < 0x0207
+#if PY_VERSION_HEX < 0x0302
 typedef long Py_hash_t;
 #endif
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2016-01-06 Thread Tomáš Chvátal
 pyuno/source/module/pyuno.cxx  |5 +
 pyuno/source/module/pyuno_impl.hxx |4 
 2 files changed, 9 insertions(+)

New commits:
commit 5c4bfb40713807e6a6453ce4a07a17fa1b0be433
Author: Tomáš Chvátal 
Date:   Tue Dec 22 17:38:41 2015 +0100

Pyuno add compat for python 2.6

Change-Id: I3e40a8006278b094d494820e6f47628c6579e78a
Reviewed-on: https://gerrit.libreoffice.org/20883
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 75f3507..1f11f3d 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -325,9 +325,14 @@ sal_Int32 lcl_PyNumber_AsSal_Int32( PyObject *pObj )
 
 // Convert Python number to platform long, then check actual value against
 // bounds of sal_Int32
+#if PY_VERSION_HEX >= 0x0207
 int nOverflow;
 long nResult = PyLong_AsLongAndOverflow( pObj,  );
 if ( nOverflow || nResult > SAL_MAX_INT32 || nResult < SAL_MIN_INT32) {
+#else
+long nResult = PyLong_AsLong( pObj );
+if ( nResult > SAL_MAX_INT32 || nResult < SAL_MIN_INT32) {
+#endif
 PyErr_SetString( PyExc_IndexError, "Python int too large to convert to 
UNO long" );
 return -1;
 }
diff --git a/pyuno/source/module/pyuno_impl.hxx 
b/pyuno/source/module/pyuno_impl.hxx
index c5d8190..39a0952 100644
--- a/pyuno/source/module/pyuno_impl.hxx
+++ b/pyuno/source/module/pyuno_impl.hxx
@@ -26,6 +26,10 @@
 
 #include 
 
+#if PY_VERSION_HEX < 0x0207
+typedef long Py_hash_t;
+#endif
+
 //Must define PyVarObject_HEAD_INIT for Python 2.5 or older
 #ifndef PyVarObject_HEAD_INIT
 #define PyVarObject_HEAD_INIT(type, size)  PyObject_HEAD_INIT(type) size,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2015-10-09 Thread Douglas Mencken
 pyuno/source/module/pyuno.cxx|4 ++--
 pyuno/source/module/pyuno_struct.cxx |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit f1e6e9e7ff739993f8a92cf268112f8be9769cbc
Author: Douglas Mencken 
Date:   Thu Oct 1 12:06:58 2015 -0400

fix build by moving python-related includes below others

This fixes build errors like "macro (...) passed 2 arguments, but takes 
just 1"

The reason is a conflict between tolower() etc. as a set of functions from 

and a hacky fix in Python's include pyport.h which tries to undefine 
tolower()
and then redefine it

Change-Id: I82e5ac19b70912d09d5e3a34c93eddc08cec9260
Reviewed-on: https://gerrit.libreoffice.org/19082
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 9e9274ab..8bd95f5 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -22,8 +22,6 @@
 #include 
 #include 
 
-#include "pyuno_impl.hxx"
-
 #include 
 #include 
 
@@ -45,6 +43,8 @@
 #include 
 #include 
 
+#include "pyuno_impl.hxx"
+
 using com::sun::star::uno::Sequence;
 using com::sun::star::uno::Reference;
 using com::sun::star::uno::XInterface;
diff --git a/pyuno/source/module/pyuno_struct.cxx 
b/pyuno/source/module/pyuno_struct.cxx
index b341386..b407426 100644
--- a/pyuno/source/module/pyuno_struct.cxx
+++ b/pyuno/source/module/pyuno_struct.cxx
@@ -22,8 +22,6 @@
 #include 
 #include 
 
-#include "pyuno_impl.hxx"
-
 #include 
 
 #include 
@@ -32,6 +30,8 @@
 
 #include 
 
+#include "pyuno_impl.hxx"
+
 using com::sun::star::uno::Sequence;
 using com::sun::star::uno::Reference;
 using com::sun::star::uno::XInterface;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source sal/osl sal/textenc sax/source sc/source

2015-08-22 Thread Michael Weghorn
 pyuno/source/module/pyuno_iterator.cxx  |3 ++-
 sal/osl/unx/random.cxx  |2 +-
 sal/textenc/tcvtmb.cxx  |3 +--
 sax/source/tools/converter.cxx  |3 ++-
 sc/source/core/data/compressedarray.cxx |3 +--
 sc/source/core/data/document.cxx|3 +--
 sc/source/core/data/dptabres.cxx|6 ++
 sc/source/core/tool/addincol.cxx|   27 ---
 sc/source/core/tool/interpr1.cxx|3 ++-
 9 files changed, 24 insertions(+), 29 deletions(-)

New commits:
commit 7e318570dc0c0878bfd2a960230a26f7e5fe2bcf
Author: Michael Weghorn m.wegh...@posteo.de
Date:   Sat Aug 22 13:08:41 2015 +0200

tdf#39440 reduce scope of local variables

This addresses some cppcheck warnings.

Change-Id: Ie492fb9c106b37c3fe7b0105236ad6315f4f159e
Reviewed-on: https://gerrit.libreoffice.org/17921
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Thorsten Behrens thorsten.behr...@cib.de

diff --git a/pyuno/source/module/pyuno_iterator.cxx 
b/pyuno/source/module/pyuno_iterator.cxx
index 9fa7971..58c6f50 100644
--- a/pyuno/source/module/pyuno_iterator.cxx
+++ b/pyuno/source/module/pyuno_iterator.cxx
@@ -63,11 +63,12 @@ PyObject* PyUNO_iterator_next( PyObject *self )
 PyUNO_iterator* me = reinterpret_castPyUNO_iterator*(self);
 
 Runtime runtime;
-bool hasMoreElements = false;
 Any aRet;
 
 try
 {
+bool hasMoreElements = false;
+
 {
 PyThreadDetach antiguard;
 
diff --git a/sal/osl/unx/random.cxx b/sal/osl/unx/random.cxx
index 04333a2..a0fb73c 100644
--- a/sal/osl/unx/random.cxx
+++ b/sal/osl/unx/random.cxx
@@ -14,7 +14,6 @@
 
 int osl_get_system_random_data(char* buffer, size_t desired_len)
 {
-ssize_t nb_read;
 int fd;
 
 assert(buffer);
@@ -23,6 +22,7 @@ int osl_get_system_random_data(char* buffer, size_t 
desired_len)
 {
 while(desired_len)
 {
+ssize_t nb_read;
 if ((nb_read = read(fd, buffer, desired_len)) == -1)
 {
 if (errno != EINTR)
diff --git a/sal/textenc/tcvtmb.cxx b/sal/textenc/tcvtmb.cxx
index 75e5b7f..cce84c1 100644
--- a/sal/textenc/tcvtmb.cxx
+++ b/sal/textenc/tcvtmb.cxx
@@ -40,7 +40,6 @@ sal_Size ImplDBCSToUnicode( const void* pData, 
SAL_UNUSED_PARAMETER void*,
 sal_uInt32 nFlags, sal_uInt32* pInfo,
 sal_Size* pSrcCvtBytes )
 {
-unsigned char   cLead;
 unsigned char   cTrail;
 sal_Unicode cConv;
 const ImplDBCSToUniLeadTab* pLeadEntry;
@@ -54,7 +53,7 @@ sal_Size ImplDBCSToUnicode( const void* pData, 
SAL_UNUSED_PARAMETER void*,
 pEndSrcBuf  = pSrcBuf+nSrcBytes;
 while ( pSrcBuf  pEndSrcBuf )
 {
-cLead = (unsigned char)*pSrcBuf;
+unsigned char cLead = (unsigned char)*pSrcBuf;
 
 /* get entry for the lead byte */
 pLeadEntry = pLeadTab+cLead;
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index d7adda1..1ed1d87 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -2035,10 +2035,11 @@ double Converter::GetConversionFactor(OUStringBuffer 
rUnit, sal_Int16 nSourceUn
 double fRetval(1.0);
 rUnit.setLength(0L);
 
-const sal_Char* psUnit = 0;
 
 if(nSourceUnit != nTargetUnit)
 {
+const sal_Char* psUnit = 0;
+
 switch(nSourceUnit)
 {
 case MeasureUnit::TWIP:
diff --git a/sc/source/core/data/compressedarray.cxx 
b/sc/source/core/data/compressedarray.cxx
index 36249d2..6411fa8 100644
--- a/sc/source/core/data/compressedarray.cxx
+++ b/sc/source/core/data/compressedarray.cxx
@@ -89,7 +89,6 @@ size_t ScCompressedArrayA,D::Search( A nAccess ) const
 long nLo= 0;
 long nHi= static_castlong(nCount) - 1;
 long nStart = 0;
-long nEnd   = 0;
 long i  = 0;
 bool bFound = (nCount == 1);
 while (!bFound  nLo = nHi)
@@ -99,7 +98,7 @@ size_t ScCompressedArrayA,D::Search( A nAccess ) const
 nStart = static_castlong(pData[i - 1].nEnd);
 else
 nStart = -1;
-nEnd = static_castlong(pData[i].nEnd);
+long nEnd = static_castlong(pData[i].nEnd);
 if (nEnd  static_castlong(nAccess))
 nLo = ++i;
 else
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 3570386..e485885 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -425,7 +425,6 @@ void ScDocument::CreateValidTabNames(std::vectorOUString 
aNames, SCTAB nCount
 OUString aStrTable = rOpt.GetInitTabPrefix();
 
 OUStringBuffer rName;
-bool bOk   = false;
 
 // First test if the prefix is valid, if so only avoid doubles
 bool bPrefix = ValidTabName( aStrTable );
@@ -435,7 +434,7 @@ void ScDocument::CreateValidTabNames(std::vectorOUString 
aNames, SCTAB 

[Libreoffice-commits] core.git: pyuno/source stoc/source

2015-07-27 Thread Matthew J . Francis
 pyuno/source/module/pyuno.cxx |   95 +++-
 pyuno/source/module/pyuno_adapter.cxx |   27 
 pyuno/source/module/pyuno_impl.hxx|9 -
 pyuno/source/module/pyuno_module.cxx  |4 
 pyuno/source/module/pyuno_runtime.cxx |   22 +--
 stoc/source/inspect/introspection.cxx |  193 --
 stoc/source/invocation/invocation.cxx |   50 +++-
 7 files changed, 288 insertions(+), 112 deletions(-)

New commits:
commit 9c5a217681935d661aad4d5667a775319382d22a
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Thu Jul 23 11:36:38 2015 +0800

Tweak introspection/invocation to be more useful to PyUNO

- Make introspection/invocation handle XNameReplace and
  XIndexReplace
- Make introspection handle XUnoTunnel
- Adapt PyUNO to take advantage of the additionally handled
  interfaces

Change-Id: Ie848d10fd2c31cad76fcc3a746262a490a2c9ae1
Reviewed-on: https://gerrit.libreoffice.org/17314
Reviewed-by: Matthew Francis mjay.fran...@gmail.com
Tested-by: Matthew Francis mjay.fran...@gmail.com

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index f068961..ccab344 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -60,6 +60,7 @@ using com::sun::star::uno::XComponentContext;
 using com::sun::star::lang::XSingleServiceFactory;
 using com::sun::star::lang::XServiceInfo;
 using com::sun::star::lang::XTypeProvider;
+using com::sun::star::lang::XUnoTunnel;
 using com::sun::star::script::XTypeConverter;
 using com::sun::star::script::XInvocation2;
 using com::sun::star::beans::XMaterialHolder;
@@ -563,7 +564,7 @@ sal_Int32 lcl_detach_getLength( PyUNO *me )
 // returned by getElementNames(), or the user may be surprised.
 
 // For XIndexContainer
-Reference XIndexAccess  xIndexAccess( me-members-wrappedObject, 
UNO_QUERY );
+Reference XIndexAccess  xIndexAccess( me-members-xInvocation, 
UNO_QUERY );
 if ( xIndexAccess.is() )
 {
 return xIndexAccess-getCount();
@@ -571,7 +572,7 @@ sal_Int32 lcl_detach_getLength( PyUNO *me )
 
 // For XNameContainer
 // Not terribly efficient - get the count of all the names
-Reference XNameAccess  xNameAccess( me-members-wrappedObject, 
UNO_QUERY );
+Reference XNameAccess  xNameAccess( me-members-xInvocation, UNO_QUERY 
);
 if ( xNameAccess.is() )
 {
 return xNameAccess-getElementNames().getLength();
@@ -782,7 +783,7 @@ PyObject* lcl_getitem_index( PyUNO *me, PyObject *pKey, 
Runtime runtime )
 {
 PyThreadDetach antiguard;
 
-Reference XIndexAccess  xIndexAccess( me-members-wrappedObject, 
UNO_QUERY );
+Reference XIndexAccess  xIndexAccess( me-members-xInvocation, 
UNO_QUERY );
 if ( xIndexAccess.is() )
 {
 if (nIndex  0)
@@ -809,7 +810,7 @@ PyObject* lcl_getitem_slice( PyUNO *me, PyObject *pKey )
 {
 PyThreadDetach antiguard;
 
-xIndexAccess.set( me-members-wrappedObject, UNO_QUERY );
+xIndexAccess.set( me-members-xInvocation, UNO_QUERY );
 if ( xIndexAccess.is() )
 nLen = xIndexAccess-getCount();
 }
@@ -850,7 +851,7 @@ PyObject* lcl_getitem_string( PyUNO *me, PyObject *pKey, 
Runtime runtime )
 {
 PyThreadDetach antiguard;
 
-Reference XNameAccess  xNameAccess( me-members-wrappedObject, 
UNO_QUERY );
+Reference XNameAccess  xNameAccess( me-members-xInvocation, 
UNO_QUERY );
 if ( xNameAccess.is() )
 {
 aRet = xNameAccess-getByName( sKey );
@@ -914,8 +915,8 @@ PyObject* PyUNO_getitem( PyObject *self, PyObject *pKey )
 // If the object is an XIndexAccess and/or XNameAccess, but the
 // key passed wasn't suitable, give a TypeError which specifically
 // describes this
-Reference XIndexAccess  xIndexAccess( me-members-wrappedObject, 
UNO_QUERY );
-Reference XNameAccess  xNameAccess( me-members-wrappedObject, 
UNO_QUERY );
+Reference XIndexAccess  xIndexAccess( me-members-xInvocation, 
UNO_QUERY );
+Reference XNameAccess  xNameAccess( me-members-xInvocation, 
UNO_QUERY );
 if ( xIndexAccess.is() || xNameAccess.is() )
 {
 PyErr_SetString( PyExc_TypeError, subscription with invalid type 
);
@@ -985,11 +986,11 @@ int lcl_setitem_index( PyUNO *me, PyObject *pKey, 
PyObject *pValue )
 {
 PyThreadDetach antiguard;
 
-xIndexContainer.set( me-members-wrappedObject, UNO_QUERY );
+xIndexContainer.set( me-members-xInvocation, UNO_QUERY );
 if ( xIndexContainer.is() )
 xIndexReplace.set( xIndexContainer, UNO_QUERY );
 else
-xIndexReplace.set( me-members-wrappedObject, UNO_QUERY );
+xIndexReplace.set( me-members-xInvocation, UNO_QUERY );
 
 if ( xIndexReplace.is()  nIndex  0 )
 nIndex += xIndexReplace-getCount();
@@ -1032,11 +1033,11 @@ int 

[Libreoffice-commits] core.git: pyuno/source

2015-07-24 Thread Matthew J . Francis
 pyuno/source/module/pyuno.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3458a252022af241f364a9d49c458180442ebd07
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Fri Jul 24 23:50:45 2015 +0800

Fix PyUNO object hash to use the correct pointer

Change-Id: Id93cba88eaf0dca0784051507809bc849d046a03
Reviewed-on: https://gerrit.libreoffice.org/17337
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Matthew Francis mjay.fran...@gmail.com

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 20e2f9f..f068961 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -411,12 +411,12 @@ Py_hash_t PyUNO_hash( PyObject *self )
 {
 Reference XMaterialHolder  xMe( me-members-xInvocation, UNO_QUERY 
);
 return sal::static_int_cast Py_hash_t ( reinterpret_cast sal_IntPtr 
 (
-xMe-getMaterial().getValue() ) );
+*static_castvoid * const *(xMe-getMaterial().getValue()) ) );
 }
 else
 {
 return sal::static_int_cast Py_hash_t ( reinterpret_cast sal_IntPtr 
 (
-me-members-wrappedObject.getValue() ) );
+*static_castvoid * const 
*(me-members-wrappedObject.getValue()) ) );
 }
 
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2015-07-21 Thread Matthew J . Francis
 pyuno/source/module/pyuno.cxx |   26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

New commits:
commit a781abe326b45573eb677030358c362394e2bc09
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Tue Jul 21 09:58:44 2015 +0800

Make PyUNO objects hashable

This allows them to be used as set members and dict keys

Change-Id: I10bd71788be6b508c6f491a27a8841e599e47e3a
Reviewed-on: https://gerrit.libreoffice.org/17248
Reviewed-by: Matthew Francis mjay.fran...@gmail.com
Tested-by: Matthew Francis mjay.fran...@gmail.com

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 413cc20..20e2f9f 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -397,6 +397,30 @@ PyObject *PyUNO_repr( PyObject  * self )
 return ret;
 }
 
+Py_hash_t PyUNO_hash( PyObject *self )
+{
+
+PyUNO *me = reinterpret_castPyUNO *(self);
+
+// Py_hash_t is not necessarily the same size as a pointer, but this is not
+// important for hashing - it just has to return the same value each time
+if( me-members-wrappedObject.getValueType().getTypeClass()
+== com::sun::star::uno::TypeClass_STRUCT ||
+me-members-wrappedObject.getValueType().getTypeClass()
+== com::sun::star::uno::TypeClass_EXCEPTION )
+{
+Reference XMaterialHolder  xMe( me-members-xInvocation, UNO_QUERY 
);
+return sal::static_int_cast Py_hash_t ( reinterpret_cast sal_IntPtr 
 (
+xMe-getMaterial().getValue() ) );
+}
+else
+{
+return sal::static_int_cast Py_hash_t ( reinterpret_cast sal_IntPtr 
 (
+me-members-wrappedObject.getValue() ) );
+}
+
+}
+
 PyObject *PyUNO_invoke( PyObject *object, const char *name , PyObject *args )
 {
 PyRef ret;
@@ -1690,7 +1714,7 @@ static PyTypeObject PyUNOType =
 PyUNONumberMethods,
 PyUNOSequenceMethods,
 PyUNOMappingMethods,
-nullptr,
+PyUNO_hash,
 nullptr,
 PyUNO_str,
 nullptr,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2015-06-30 Thread Matthew J . Francis
 pyuno/source/module/pyuno.cxx  |8 +++-
 pyuno/source/module/pyuno_impl.hxx |7 ---
 2 files changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 3a6ec53c71312f5ea890689f9c2ee79c2aac
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Tue Jun 30 10:07:23 2015 -0400

Fix compilation with Python 2.7

Change-Id: I0dd118f0215e06fec0cccff9b46d80f13bd802cc
Reviewed-on: https://gerrit.libreoffice.org/16620
Reviewed-by: Matthew Francis mjay.fran...@gmail.com
Tested-by: Matthew Francis mjay.fran...@gmail.com

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 8f7a6a6..413cc20 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -338,7 +338,13 @@ int lcl_PySlice_GetIndicesEx( PyObject *pObject, sal_Int32 
nLen, sal_Int32 *nSta
 {
 Py_ssize_t nStart_ssize, nStop_ssize, nStep_ssize, nSliceLength_ssize;
 
-int nResult = PySlice_GetIndicesEx( 
static_castPySliceObject_t*(pObject), nLen, nStart_ssize, nStop_ssize, 
nStep_ssize, nSliceLength_ssize );
+int nResult = PySlice_GetIndicesEx(
+#if PY_VERSION_HEX = 0x030200f0
+pObject,
+#else
+reinterpret_castPySliceObject*(pObject),
+#endif
+nLen, nStart_ssize, nStop_ssize, nStep_ssize, nSliceLength_ssize );
 if (nResult == -1)
 return -1;
 
diff --git a/pyuno/source/module/pyuno_impl.hxx 
b/pyuno/source/module/pyuno_impl.hxx
index 5f0df95..11fbfa2 100644
--- a/pyuno/source/module/pyuno_impl.hxx
+++ b/pyuno/source/module/pyuno_impl.hxx
@@ -143,13 +143,6 @@ inline PyObject* PyStrBytes_FromStringAndSize(const char 
*string, Py_ssize_t len
 }
 #endif /* PY_MAJOR_VERSION = 3 */
 
-// Type of argument to PySlice_GetIndicesEx() changed in Python 3.2
-#if PY_VERSION_HEX = 0x030200f0
-typedef PyObject PySliceObject_t;
-#else
-typedef PySliceObject PySliceObject_t;
-#endif
-
 namespace pyuno
 {
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2015-06-30 Thread Matthew J . Francis
 pyuno/source/module/uno.py |   31 ++-
 1 file changed, 30 insertions(+), 1 deletion(-)

New commits:
commit 33776d143fabc1b6e91a6bad54899e9f33ca2320
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Wed Jul 1 13:14:25 2015 +0800

PyUNO: Allow import of constant group by name

Change-Id: I0ea809a888187624261182552cf7fa0a9c96c648

diff --git a/pyuno/source/module/uno.py b/pyuno/source/module/uno.py
index a8873ae..4c78595 100644
--- a/pyuno/source/module/uno.py
+++ b/pyuno/source/module/uno.py
@@ -303,7 +303,11 @@ def _uno_import( name, *optargs, **kwargs ):
try:
   d[x] = getConstantByName( name + . + x )
except RuntimeException:
-  failed = True
+  # check for constant group
+  try:
+  d[x] = _impl_getConstantGroupByName( name, x )
+  except ValueError:
+  failed = True
 
   if failed:
   # We have an import failure, but cannot distinguish between
@@ -336,6 +340,31 @@ def _uno_import( name, *optargs, **kwargs ):
 
 return mod
 
+# private
+class _ConstantGroup(object):
+__slots__ = ['_constants']
+def __init__(self, constants):
+self._constants = constants
+def __dir__(self):
+return self._constants.keys()
+def __getattr__(self,name):
+if name in self._constants:
+return self._constants[name]
+raise AttributeError
+
+# private
+def _impl_getConstantGroupByName( module, group ):
+CONSTANTS = Enum('com.sun.star.uno.TypeClass', 'CONSTANTS')
+ONE = Enum('com.sun.star.reflection.TypeDescriptionSearchDepth', 'ONE')
+tdm = 
_g_ctx.getValueByName('/singletons/com.sun.star.reflection.theTypeDescriptionManager')
+tde = tdm.createTypeDescriptionEnumeration(module,(CONSTANTS,),ONE)
+qualifiedName = module + '.' + group
+for td in tde:
+if td.Name == qualifiedName:
+return _ConstantGroup({c.Name.split('.')[-1]: c.ConstantValue for 
c in td.Constants})
+else:
+raise ValueError
+
 # private function, don't use
 def _impl_extractName(name):
 r = list(range(len(name)-1,0,-1))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2015-06-26 Thread Stephan Bergmann
 pyuno/source/module/pyuno_iterator.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e29a7ff18771eea77b385efc517baa6204df37f9
Author: Stephan Bergmann sberg...@redhat.com
Date:   Fri Jun 26 14:04:43 2015 +0200

loplugin:salbool

Change-Id: I9975a87f6df2b7a79c376130864e9eb54bc3452b

diff --git a/pyuno/source/module/pyuno_iterator.cxx 
b/pyuno/source/module/pyuno_iterator.cxx
index f9dd8d0..9fa7971 100644
--- a/pyuno/source/module/pyuno_iterator.cxx
+++ b/pyuno/source/module/pyuno_iterator.cxx
@@ -63,7 +63,7 @@ PyObject* PyUNO_iterator_next( PyObject *self )
 PyUNO_iterator* me = reinterpret_castPyUNO_iterator*(self);
 
 Runtime runtime;
-sal_Bool hasMoreElements = sal_False;
+bool hasMoreElements = false;
 Any aRet;
 
 try
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2015-06-26 Thread Stephan Bergmann
 pyuno/source/module/pyuno_runtime.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7f9a65862b37ee1fa596916ceb7c243e04612499
Author: Stephan Bergmann sberg...@redhat.com
Date:   Fri Jun 26 14:03:46 2015 +0200

loplugin:loopvartoosmall

Change-Id: I19d801444e4d1db5576b5742c60fc138384d3b70

diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index 1aba10a..e92ad56 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -766,7 +766,7 @@ Any Runtime::pyObject2Any ( const PyRef  source, enum 
ConversionMode mode ) con
 {
 Py_ssize_t l = PyList_Size (o);
 SequenceAny s (l);
-for (int i = 0; i  l; i++)
+for (Py_ssize_t i = 0; i  l; i++)
 {
 s[i] = pyObject2Any (PyList_GetItem (o, i), mode );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2015-06-26 Thread Stephan Bergmann
 pyuno/source/module/pyuno.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ce75e5b931373368b35dc9a150250c014454d82a
Author: Stephan Bergmann sberg...@redhat.com
Date:   Fri Jun 26 14:10:03 2015 +0200

loplugin:implicitboolconversion

Change-Id: If495a415d4263d1932c03a31d07a517218533847

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 413cab0..8f7a6a6 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -558,7 +558,7 @@ int PyUNO_bool( PyObject* self )
 {
 int nLen = lcl_detach_getLength( me );
 if (nLen = 0)
-return !!nLen;
+return nLen == 0 ? 0 : 1;
 
 // Anything which doesn't have members is a scalar object and 
therefore true
 return 1;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2015-06-26 Thread Stephan Bergmann
 pyuno/source/module/pyuno.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2a807ca13748af3ef82f4720c497a511b30a3ec7
Author: Stephan Bergmann sberg...@redhat.com
Date:   Fri Jun 26 14:06:45 2015 +0200

loplugin:passstuffbyref

Change-Id: I66410932347b4f65c4b24b5316009ecffc8aef06

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index c4f82d3..8c6fc5f 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -358,7 +358,7 @@ int lcl_PySlice_GetIndicesEx( PyObject *pObject, sal_Int32 
nLen, sal_Int32 *nSta
 return 0;
 }
 
-bool lcl_hasInterfaceByName( Any object, OUString interfaceName )
+bool lcl_hasInterfaceByName( Any const object, OUString const  interfaceName 
)
 {
 Reference XInterface  xInterface( object, UNO_QUERY );
 TypeDescription typeDesc( interfaceName );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2015-06-26 Thread Stephan Bergmann
 pyuno/source/module/pyuno.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8811c41abcbcb39ff79f570dfa094587e8cb95f2
Author: Stephan Bergmann sberg...@redhat.com
Date:   Fri Jun 26 14:07:54 2015 +0200

loplugin:cstylecast

Change-Id: I5f0bceb240a492c7c010b4356bc8efafdd83bf24

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 8c6fc5f..413cab0 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -338,7 +338,7 @@ int lcl_PySlice_GetIndicesEx( PyObject *pObject, sal_Int32 
nLen, sal_Int32 *nSta
 {
 Py_ssize_t nStart_ssize, nStop_ssize, nStep_ssize, nSliceLength_ssize;
 
-int nResult = PySlice_GetIndicesEx( (PySliceObject_t*)pObject, nLen, 
nStart_ssize, nStop_ssize, nStep_ssize, nSliceLength_ssize );
+int nResult = PySlice_GetIndicesEx( 
static_castPySliceObject_t*(pObject), nLen, nStart_ssize, nStop_ssize, 
nStep_ssize, nSliceLength_ssize );
 if (nResult == -1)
 return -1;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2015-06-26 Thread Stephan Bergmann
 pyuno/source/module/pyuno.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c44021f754148dda502c700716c54efd1c6e7cf9
Author: Stephan Bergmann sberg...@redhat.com
Date:   Fri Jun 26 14:05:44 2015 +0200

loplugin:salbool

Change-Id: I4875b12807aed36f758d81c731e2ac52a3a606e4

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index ce9983e..c4f82d3 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -1346,8 +1346,8 @@ int PyUNO_contains( PyObject *self, PyObject *pKey )
 xNameAccess.set( me-members-wrappedObject, UNO_QUERY );
 if ( xNameAccess.is() )
 {
-sal_Bool hasKey = xNameAccess-hasByName( sKey );
-return hasKey == sal_True ? 1 : 0;
+bool hasKey = xNameAccess-hasByName( sKey );
+return hasKey ? 1 : 0;
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2015-06-13 Thread Julien Nabet
 pyuno/source/module/pyuno_callable.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ad84b40b084cb6c6c129c687303fb863b8b3f746
Author: Julien Nabet serval2...@yahoo.fr
Date:   Sun Jun 14 01:15:14 2015 +0200

Typo: pyhton-python

Change-Id: I16d1b8b88753c593a5a1ab9e32a8e0264514

diff --git a/pyuno/source/module/pyuno_callable.cxx 
b/pyuno/source/module/pyuno_callable.cxx
index 6a96369..3e47361 100644
--- a/pyuno/source/module/pyuno_callable.cxx
+++ b/pyuno/source/module/pyuno_callable.cxx
@@ -91,7 +91,7 @@ PyObject* PyUNO_callable_call(
 }
 
 {
-PyThreadDetach antiguard; //pyhton free zone
+PyThreadDetach antiguard; //python free zone
 
 // do some logging if desired ...
 if( isLog( cargo, LogLevel::CALL ) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2015-06-12 Thread Julien Nabet
 pyuno/source/module/pyuno_adapter.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 22009c987b88fe9c4f0b5d6252c05f44b80d
Author: Julien Nabet serval2...@yahoo.fr
Date:   Fri Jun 12 23:57:19 2015 +0200

Typo: Adapater-Adapter

Change-Id: I696c0693dc7a69dc3a4b8df0c4e8571414d5b9a6

diff --git a/pyuno/source/module/pyuno_adapter.cxx 
b/pyuno/source/module/pyuno_adapter.cxx
index 38988b5..1fbfcba 100644
--- a/pyuno/source/module/pyuno_adapter.cxx
+++ b/pyuno/source/module/pyuno_adapter.cxx
@@ -229,7 +229,7 @@ Any Adapter::invoke( const OUString aFunctionName,
 if( !method.is() )
 {
 OUStringBuffer buf;
-buf.appendAscii( pyuno::Adapater: Method  ).append( 
aFunctionName );
+buf.appendAscii( pyuno::Adapter: Method  ).append( aFunctionName 
);
 buf.appendAscii(  is not implemented at object  );
 PyRef str( PyObject_Repr( mWrappedObject.get() ), SAL_NO_ACQUIRE );
 buf.append(pyString2ustring(str.get()));
@@ -347,7 +347,7 @@ void Adapter::setValue( const OUString  aPropertyName, 
const Any  value )
 if( !hasProperty( aPropertyName ) )
 {
 OUStringBuffer buf;
-buf.appendAscii( pyuno::Adapater: Property  ).append( aPropertyName 
);
+buf.appendAscii( pyuno::Adapter: Property  ).append( aPropertyName );
 buf.appendAscii(  is unknown. );
 throw UnknownPropertyException( buf.makeStringAndClear() );
 }
@@ -383,7 +383,7 @@ Any Adapter::getValue( const OUString  aPropertyName )
 if (!pyRef.is() || PyErr_Occurred())
 {
 OUStringBuffer buf;
-buf.appendAscii( pyuno::Adapater: Property  ).append( 
aPropertyName );
+buf.appendAscii( pyuno::Adapter: Property  ).append( 
aPropertyName );
 buf.appendAscii(  is unknown. );
 throw UnknownPropertyException( buf.makeStringAndClear() );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source scripting/examples scripting/source

2015-03-02 Thread Michael Stahl
 0 files changed

New commits:
commit e557b160fd59674b8d98e53e4641328a1d6fa61e
Author: Michael Stahl mst...@redhat.com
Date:   Mon Mar 2 13:25:43 2015 +0100

pyuno, scripting: remove executable bits from python, js, bsh files

Change-Id: Id108693d84fbca7764614e126ee1b3b045baec17

diff --git a/pyuno/source/officehelper.py b/pyuno/source/officehelper.py
old mode 100755
new mode 100644
diff --git a/scripting/examples/beanshell/Capitalise/capitalise.bsh 
b/scripting/examples/beanshell/Capitalise/capitalise.bsh
old mode 100755
new mode 100644
diff --git a/scripting/examples/beanshell/HelloWorld/helloworld.bsh 
b/scripting/examples/beanshell/HelloWorld/helloworld.bsh
old mode 100755
new mode 100644
diff --git a/scripting/examples/beanshell/Highlight/ButtonPressHandler.bsh 
b/scripting/examples/beanshell/Highlight/ButtonPressHandler.bsh
old mode 100755
new mode 100644
diff --git a/scripting/examples/beanshell/Highlight/ShowDialog.bsh 
b/scripting/examples/beanshell/Highlight/ShowDialog.bsh
old mode 100755
new mode 100644
diff --git a/scripting/examples/beanshell/Highlight/highlighter.bsh 
b/scripting/examples/beanshell/Highlight/highlighter.bsh
old mode 100755
new mode 100644
diff --git a/scripting/examples/beanshell/InteractiveBeanShell/interactive.bsh 
b/scripting/examples/beanshell/InteractiveBeanShell/interactive.bsh
old mode 100755
new mode 100644
diff --git a/scripting/examples/beanshell/MemoryUsage/memusage.bsh 
b/scripting/examples/beanshell/MemoryUsage/memusage.bsh
old mode 100755
new mode 100644
diff --git a/scripting/examples/beanshell/WordCount/wordcount.bsh 
b/scripting/examples/beanshell/WordCount/wordcount.bsh
old mode 100755
new mode 100644
diff --git 
a/scripting/examples/javascript/ExportSheetsToHTML/exportsheetstohtml.js 
b/scripting/examples/javascript/ExportSheetsToHTML/exportsheetstohtml.js
old mode 100755
new mode 100644
diff --git a/scripting/examples/javascript/HelloWorld/helloworld.js 
b/scripting/examples/javascript/HelloWorld/helloworld.js
old mode 100755
new mode 100644
diff --git a/scripting/examples/javascript/Highlight/ButtonPressHandler.js 
b/scripting/examples/javascript/Highlight/ButtonPressHandler.js
old mode 100755
new mode 100644
diff --git a/scripting/examples/javascript/Highlight/ShowDialog.js 
b/scripting/examples/javascript/Highlight/ShowDialog.js
old mode 100755
new mode 100644
diff --git a/scripting/source/pyprov/mailmerge.py 
b/scripting/source/pyprov/mailmerge.py
old mode 100755
new mode 100644
diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
old mode 100755
new mode 100644
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source sal/osl

2014-11-25 Thread Stephan Bergmann
 pyuno/source/module/pyuno_module.cxx |5 -
 sal/osl/unx/process_impl.cxx |   21 -
 sal/osl/w32/process.cxx  |   15 ++-
 3 files changed, 10 insertions(+), 31 deletions(-)

New commits:
commit 2ad716f406e0fdb9b9294876c64ae92fecbf5e27
Author: Stephan Bergmann sberg...@redhat.com
Date:   Tue Nov 25 23:22:13 2014 +0100

Revert pyuno: set up fake command line in getComponentContext()

This reverts commit 2386a92c1e6e8ec263edb4dc4fdcfeaa4673ce1f and its 
follow-ups
1acaa577b67158c060d2f57414f7aea86504a489 sal: add special handling of 
argc==0
to osl_setCommandArgs() and 01f27b5e5d428cc3c4aeabdcbbb8204494fbd435 sal: 
fix
osl_setCommandArgs() on WNT.

The situation that osl_getCommandArgCount is called without a prior call to
osl_setCommandArgs should be considered as harmless and can legitimately not
only happen in the pyuno case discussed in the reverted commits, but also in
case binary UNO is bootstrapped from within a Java process, as happens in
test-javanative in ure/source/uretest/Makefile.

Change-Id: I2829db390e37dfe5daeda33a4c0659b7d35e565a

diff --git a/pyuno/source/module/pyuno_module.cxx 
b/pyuno/source/module/pyuno_module.cxx
index e7ebb73..c2ca67b 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -27,7 +27,6 @@
 
 #include osl/module.hxx
 #include osl/thread.h
-#include osl/process.h
 #include osl/file.hxx
 
 #include typelib/typedescription.hxx
@@ -250,10 +249,6 @@ static PyObject* getComponentContext(
 }
 else
 {
-// cppu::defaultBootstrap_InitialComponentContext expects
-// command line arguments to be present
-osl_setCommandArgs(0, 0); // fake it
-
 OUString iniFile;
 if( path.isEmpty() )
 {
diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx
index 56c4925..3942f14 100644
--- a/sal/osl/unx/process_impl.cxx
+++ b/sal/osl/unx/process_impl.cxx
@@ -164,7 +164,7 @@ sal_uInt32 SAL_CALL osl_getCommandArgCount (void)
 sal_uInt32 result = 0;
 
 pthread_mutex_lock ((g_command_args.m_mutex));
-assert (g_command_args.m_nCount != 0);
+SAL_WARN_IF (g_command_args.m_nCount == 0, sal.osl, 
osl_setCommandArgs() not called before calling osl_getCommandArgCount());
 if (g_command_args.m_nCount  0)
 result = g_command_args.m_nCount - 1;
 pthread_mutex_unlock ((g_command_args.m_mutex));
@@ -204,26 +204,13 @@ int SAL_CALL osl_areCommandArgsSet (void)
  **/
 void SAL_CALL osl_setCommandArgs (int argc, char ** argv)
 {
-// special case for argc == 0: set up fake command line
-int nArgs(argc ? argc : 1);
+OSL_ASSERT(argc  0);
 pthread_mutex_lock ((g_command_args.m_mutex));
 assert (g_command_args.m_nCount == 0);
 if (g_command_args.m_nCount == 0)
 {
-rtl_uString** ppArgs =
-(rtl_uString**)rtl_allocateZeroMemory(nArgs * 
sizeof(rtl_uString*));
-if (ppArgs != 0  argc == 0)
-{
-// special case: set up fake command line
-char const*const arg =
-this is just a fake and cheap imitation of a command line;
-rtl_string2UString(ppArgs[0],
-arg, rtl_str_getLength(arg), RTL_TEXTENCODING_ASCII_US,
-OSTRING_TO_OUSTRING_CVTFLAGS);
-g_command_args.m_nCount = nArgs;
-g_command_args.m_ppArgs = ppArgs;
-}
-else if (ppArgs != 0)
+rtl_uString** ppArgs = (rtl_uString**)rtl_allocateZeroMemory (argc * 
sizeof(rtl_uString*));
+if (ppArgs != 0)
 {
 rtl_TextEncoding encoding = osl_getThreadTextEncoding();
 for (int i = 0; i  argc; i++)
diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx
index 786e299..6db821b 100644
--- a/sal/osl/w32/process.cxx
+++ b/sal/osl/w32/process.cxx
@@ -259,20 +259,16 @@ static struct CommandArgs_Impl g_command_args =
 #pragma warning( push )
 #pragma warning( disable: 4100 )
 #endif
-static rtl_uString ** osl_createCommandArgs_Impl (int  argc, char **)
+static rtl_uString ** osl_createCommandArgs_Impl (int argc, char **)
 {
-int nArgs(0);
-LPWSTR *wargv = CommandLineToArgvW( GetCommandLineW(), nArgs );
-if (argc != nArgs)
-{
-assert(argc == 0 /* special case - faked */);
-argc = nArgs;
-}
 rtl_uString ** ppArgs =
-(rtl_uString**)rtl_allocateZeroMemory(nArgs * sizeof(rtl_uString*));
+(rtl_uString**)rtl_allocateZeroMemory (argc * sizeof(rtl_uString*));
 if (ppArgs != 0)
 {
 int i;
+int nArgs;
+LPWSTR *wargv = CommandLineToArgvW( GetCommandLineW(), nArgs );
+OSL_ASSERT( nArgs == argc );
 for (i = 0; i  nArgs; i++)
 {
 /* Convert to unicode */
@@ -385,6 +381,7 @@ int SAL_CALL osl_areCommandArgsSet(void)
 
 void SAL_CALL 

[Libreoffice-commits] core.git: pyuno/source

2014-10-30 Thread Stephan Bergmann
 pyuno/source/module/pyuno.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 4d7c414a8dd60f49073d3b34e1c37ad5e427a377
Author: Stephan Bergmann sberg...@redhat.com
Date:   Thu Oct 30 09:33:01 2014 +0100

Add include

Change-Id: I0598e9d0c9c33c538aa02eabc2c09d96ec3c9b4d

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 065513a..a4f0d1e 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include sal/config.h
+
+#include cassert
+
 #include pyuno_impl.hxx
 
 #include rtl/strbuf.hxx
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2014-10-29 Thread Naruhiko Ogasawara
 pyuno/source/module/pyuno.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 922f2005f34589e60969be3f2bf74e4af58e2e69
Author: Naruhiko Ogasawara naru...@gmail.com
Date:   Sat Oct 25 17:54:22 2014 +0900

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT

- Clean up OSL_ASSERT

Change-Id: I1f3a5dcfe08876da9bb4a8486311eb0ca9bab215
Signed-off-by: Stephan Bergmann sberg...@redhat.com

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index f468149..065513a 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -66,7 +66,7 @@ void PyUNO_del (PyObject* self)
 
 OUString val2str( const void * pVal, typelib_TypeDescriptionReference * 
pTypeRef , sal_Int32 mode )
 {
-OSL_ASSERT( pVal );
+assert( pVal );
 if (pTypeRef-eTypeClass == typelib_TypeClass_VOID)
 return OUString(void);
 
@@ -124,7 +124,7 @@ OUString val2str( const void * pVal, 
typelib_TypeDescriptionReference * pTypeRef
 buf.append( {  );
 typelib_TypeDescription * pTypeDescr = 0;
 TYPELIB_DANGER_GET( pTypeDescr, pTypeRef );
-OSL_ASSERT( pTypeDescr );
+assert( pTypeDescr );
 
 typelib_CompoundTypeDescription * pCompType = 
(typelib_CompoundTypeDescription *)pTypeDescr;
 sal_Int32 nDescr = pCompType-nMembers;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2014-09-21 Thread Tor Lillqvist
 pyuno/source/loader/pyuno_loader.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 4e124fd1409af419990bacade74fcf355624243f
Author: Tor Lillqvist t...@collabora.com
Date:   Sun Sep 21 20:46:03 2014 +0300

Don't try to write Python bytecode files in case of a read-only installset

It causes annoying messages in the system log in the OS X sandboxed
case.

Change-Id: I8ae3eb34df2c045bdbdfc63cae9007f973c42537

diff --git a/pyuno/source/loader/pyuno_loader.cxx 
b/pyuno/source/loader/pyuno_loader.cxx
index 36d6ffd..d43bf73 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include config_features.h
 #include config_folders.h
 
 #include pyuno/pyuno.hxx
@@ -218,6 +219,11 @@ Reference XInterface  CreateInstance( const Reference 
XComponentContext   c
 #else
 PyImport_AppendInittab( (char*)pyuno, initpyuno );
 #endif
+
+#if HAVE_FEATURE_READONLY_INSTALLSET
+Py_DontWriteBytecodeFlag = 1;
+#endif
+
 // initialize python
 Py_Initialize();
 PyEval_InitThreads();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2014-08-28 Thread Michael Stahl
 pyuno/source/module/pyuno_runtime.cxx |   18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

New commits:
commit 0364d3b7e670bddb49d5132268cf28737c3301c6
Author: Michael Stahl mst...@redhat.com
Date:   Thu Aug 28 15:11:37 2014 +0200

fdo#46678: pyuno: fix deadlock in Runtime::any2PyObject()

When calling XUnoTunnel::getSomething(), the function must drop the
CPython GIL to avoid deadlock since there are implementations of
XUnoTunnel that acquire SolarMutex.

Change-Id: I51ffce9bdee9a51c932902e77856f865eae81d2a

diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index c6d1629..9023d39 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -550,13 +550,19 @@ PyRef Runtime::any2PyObject (const Any a ) const
 }
 case typelib_TypeClass_INTERFACE:
 {
-Reference XUnoTunnel  tunnel;
-a = tunnel;
-if( tunnel.is() )
+// fdo#46678 must unlock GIL because getSomething could acquire locks,
+// and queryInterface too...
 {
-sal_Int64 that = tunnel-getSomething( 
::pyuno::Adapter::getUnoTunnelImplementationId() );
-if( that )
-return ((Adapter*)sal::static_int_cast sal_IntPtr 
(that))-getWrappedObject();
+PyThreadDetach d;
+
+ReferenceXUnoTunnel tunnel;
+a = tunnel;
+if (tunnel.is())
+{
+sal_Int64 that = tunnel-getSomething( 
::pyuno::Adapter::getUnoTunnelImplementationId() );
+if( that )
+return ((Adapter*)sal::static_int_cast sal_IntPtr 
(that))-getWrappedObject();
+}
 }
 //This is just like the struct case:
 return PyRef( PyUNO_new (a, getImpl()-cargo-xInvocation), 
SAL_NO_ACQUIRE );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2014-02-26 Thread Alexander Wilms
 pyuno/source/module/pyuno_impl.hxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 3a35e28628a6d9fd9100e35754eaba1db9bf1d50
Author: Alexander Wilms f.alexander.wi...@gmail.com
Date:   Tue Feb 25 19:39:53 2014 +0100

Remove visual noise from pyuno

Change-Id: I27f5edf45d5968879436e2466f953576651ed8ae
Reviewed-on: https://gerrit.libreoffice.org/8290
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/pyuno/source/module/pyuno_impl.hxx 
b/pyuno/source/module/pyuno_impl.hxx
index 805466f..ae0f85f 100644
--- a/pyuno/source/module/pyuno_impl.hxx
+++ b/pyuno/source/module/pyuno_impl.hxx
@@ -131,9 +131,9 @@ inline PyObject* PyStrBytes_FromStringAndSize(const char 
*string, Py_ssize_t len
 namespace pyuno
 {
 
-//--
+
 // Logging API - implementation can be found in pyuno_util
-//--
+
 struct RuntimeCargo;
 namespace LogLevel
 {
@@ -159,7 +159,7 @@ void logException( RuntimeCargo *cargo, const char *intro,
 static const sal_Int32 VAL2STR_MODE_DEEP = 0;
 static const sal_Int32 VAL2STR_MODE_SHALLOW = 1;
 OUString val2str( const void * pVal, typelib_TypeDescriptionReference * 
pTypeRef, sal_Int32 mode = VAL2STR_MODE_DEEP ) SAL_THROW(());
-//--
+
 
 typedef ::boost::unordered_map
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2014-01-30 Thread Stephan Bergmann
 pyuno/source/module/pyuno.cxx |   45 ++
 1 file changed, 20 insertions(+), 25 deletions(-)

New commits:
commit b1de7935b81d95875f625676b7dd6e6b059309e4
Author: Stephan Bergmann sberg...@redhat.com
Date:   Thu Jan 30 12:01:27 2014 +0100

coverity#983054, reorder code to avoid memory leak

Change-Id: If14160802f77673e3ebe69850e00d0506125969c

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index be89061..ece4560 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -741,36 +741,31 @@ PyObject* PyUNO_new_UNCHECKED (
 const Any targetInterface,
 const ReferenceXSingleServiceFactory ssf )
 {
-PyUNO* self;
-SequenceAny arguments (1);
 ReferenceXInterface tmp_interface;
-
-self = PyObject_New (PyUNO, PyUNOType);
-if (self == NULL)
-return NULL; // == error
-self-members = new PyUNOInternals();
-
-arguments[0] = targetInterface;
+ReferenceXInvocation2 tmp_invocation;
 {
 PyThreadDetach antiguard;
-tmp_interface = ssf-createInstanceWithArguments (arguments);
-
-if (!tmp_interface.is ())
-{
-Py_INCREF( Py_None );
-return Py_None;
-}
-
-ReferenceXInvocation2 tmp_invocation (tmp_interface, UNO_QUERY);
-if (!tmp_invocation.is()) {
-throw RuntimeException (OUString::createFromAscii (
-XInvocation2 not implemented, cannot interact with object),
-Reference XInterface  ());
+SequenceAny arguments(1);
+arguments[0] = targetInterface;
+tmp_interface = ssf-createInstanceWithArguments(arguments);
+tmp_invocation.set(tmp_interface, UNO_QUERY);
+if (!tmp_invocation.is()  tmp_interface.is()) {
+throw RuntimeException(
+XInvocation2 not implemented, cannot interact with object,
+ReferenceXInterface());
 }
-
-self-members-xInvocation = tmp_invocation;
-self-members-wrappedObject = targetInterface;
 }
+if (!tmp_interface.is())
+{
+Py_INCREF( Py_None );
+return Py_None;
+}
+PyUNO* self = PyObject_New (PyUNO, PyUNOType);
+if (self == NULL)
+return NULL; // == error
+self-members = new PyUNOInternals();
+self-members-xInvocation = tmp_invocation;
+self-members-wrappedObject = targetInterface;
 return (PyObject*) self;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2014-01-07 Thread Stephan Bergmann
 pyuno/source/loader/pythonloader.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 431b49fbec68c17c7a486ef0f577107d3dd27e55
Author: Stephan Bergmann sberg...@redhat.com
Date:   Tue Jan 7 15:37:16 2014 +0100

No serviceNames attribute in Loader

Change-Id: I6cc001d18683fc412f0ec0b6a33054d6e745463f

diff --git a/pyuno/source/loader/pythonloader.py 
b/pyuno/source/loader/pythonloader.py
index 3074d0f..1d1b7de 100644
--- a/pyuno/source/loader/pythonloader.py
+++ b/pyuno/source/loader/pythonloader.py
@@ -157,7 +157,7 @@ class Loader( XImplementationLoader, XServiceInfo, 
unohelper.Base ):
 return g_implementationName
 
 def supportsService( self, ServiceName ):
-return ServiceName in self.serviceNames
+return ServiceName in self.getSupportedServiceNames()
 
 def getSupportedServiceNames( self ):
 return g_supportedServices
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source sfx2/source solenv/gcc-wrappers wizards/com writerfilter/source

2013-11-25 Thread Julien Nabet
 pyuno/source/module/pyuno_runtime.cxx|2 +-
 sfx2/source/control/objface.cxx  |2 +-
 solenv/gcc-wrappers/wrapper.cxx  |2 +-
 wizards/com/sun/star/wizards/web/AbstractErrorHandler.py |6 +++---
 wizards/com/sun/star/wizards/web/FTPDialog.py|8 
 writerfilter/source/doctok/resources.xmi |4 ++--
 6 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 983e0332737c9bdb114ca2132f4c90d33428dbba
Author: Julien Nabet serval2...@yahoo.fr
Date:   Mon Nov 25 22:05:13 2013 +0100

Fix different typos for unknown

Change-Id: Ib2ee00d4e9f4c6c05d090adfcd5fb791fcbca72c

diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index bb7cb8e..5f85ca0 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -566,7 +566,7 @@ PyRef Runtime::any2PyObject (const Any a ) const
 default:
 {
 OUStringBuffer buf;
-buf.appendAscii( Unknonwn UNO type class  );
+buf.appendAscii( Unknown UNO type class  );
 buf.append( (sal_Int32 ) a.getValueTypeClass() );
 throw RuntimeException(buf.makeStringAndClear( ), Reference 
XInterface  () );
 }
diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx
index 2778b39..9242e94 100644
--- a/sfx2/source/control/objface.cxx
+++ b/sfx2/source/control/objface.cxx
@@ -366,7 +366,7 @@ const SfxSlot* SfxInterface::GetRealSlot( sal_uInt16 
nSlotId ) const
 {
 if(pGenoType)
 return pGenoType-GetRealSlot(nSlotId);
-OSL_FAIL(unkonown Slot);
+OSL_FAIL(unknown Slot);
 return 0;
 }
 
diff --git a/solenv/gcc-wrappers/wrapper.cxx b/solenv/gcc-wrappers/wrapper.cxx
index 42ead2f..a3bd84a 100644
--- a/solenv/gcc-wrappers/wrapper.cxx
+++ b/solenv/gcc-wrappers/wrapper.cxx
@@ -108,7 +108,7 @@ string processccargs(vectorstring rawargs) {
 }
 else
 {
-cerr  unknonwn -o argument - please adapt gcc-wrapper for 
\
+cerr  unknown -o argument - please adapt gcc-wrapper for \
   (*i)  \;
 exit(1);
 }
diff --git a/wizards/com/sun/star/wizards/web/AbstractErrorHandler.py 
b/wizards/com/sun/star/wizards/web/AbstractErrorHandler.py
index 3f9a102..52fb229 100644
--- a/wizards/com/sun/star/wizards/web/AbstractErrorHandler.py
+++ b/wizards/com/sun/star/wizards/web/AbstractErrorHandler.py
@@ -109,7 +109,7 @@ class AbstractErrorHandler(ErrorHandler):
 return 2
 elif (errorType in (ErrorHandler.ERROR_WARNING, 
ErrorHandler.ERROR_MESSAGE)):
 return 1
-raise ValueError(unkonown error type)
+raise ValueError(unknown error type)
 
 
 # @param errorType
@@ -136,7 +136,7 @@ class AbstractErrorHandler(ErrorHandler):
 return OK
 elif (errorType == ErrorHandler.ERROR_MESSAGE):
 return OK
-raise ValueError(unkonown error type)
+raise ValueError(unknown error type)
 
 # @deprecated
 # @param errorType
@@ -163,7 +163,7 @@ class AbstractErrorHandler(ErrorHandler):
 return warningbox
 elif (errorType == ErrorHandler.ERROR_MESSAGE):
 return infobox
-raise ValueError(unkonown error type)
+raise ValueError(unknown error type)
 
 # renders the error
 # @param ex the exception
diff --git a/wizards/com/sun/star/wizards/web/FTPDialog.py 
b/wizards/com/sun/star/wizards/web/FTPDialog.py
index 17d8690..5507ada 100644
--- a/wizards/com/sun/star/wizards/web/FTPDialog.py
+++ b/wizards/com/sun/star/wizards/web/FTPDialog.py
@@ -60,7 +60,7 @@ class FTPDialog(UnoDialog2, UIConsts):
 # A Constant used for the setLabel(int) method to change the
 # status-display. unknown is the status when the user first
 # opens the dialog, or changes the servername/username/password.
-STATUS_UNKONWN = 0
+STATUS_UNKNOWN = 0
 # A Constant used for the setLabel(int) method to change the
 # status-display. (connection established)
 STATUS_OK = 1
@@ -216,7 +216,7 @@ class FTPDialog(UnoDialog2, UIConsts):
 self.username =  if (self.publish.cp_Username == None) else 
self.publish.cp_Username
 self.password =  if (self.publish.password == None) else 
self.publish.password
 self.folder = self.extractDir(self.publish.cp_URL)
-self.setLabel(self.STATUS_UNKONWN)
+self.setLabel(self.STATUS_UNKNOWN)
 
 self.enableTestButton()
 self.updateUI()
@@ -365,14 +365,14 @@ class FTPDialog(UnoDialog2, UIConsts):
 self.enableTestButton()
 self.setEnabled(self.btnOK, False)
 self.setEnabled(self.btnDir, False)
-self.setLabel(self.STATUS_UNKONWN)
+self.setLabel(self.STATUS_UNKNOWN)
 
 # changes the status label and icon, according to 

[Libreoffice-commits] core.git: pyuno/source sal/osl

2013-10-10 Thread Michael Stahl
 pyuno/source/module/pyuno_module.cxx |5 +
 sal/osl/unx/process_impl.cxx |   19 ---
 sal/osl/w32/process.cxx  |8 
 3 files changed, 21 insertions(+), 11 deletions(-)

New commits:
commit 1acaa577b67158c060d2f57414f7aea86504a489
Author: Michael Stahl mst...@redhat.com
Date:   Thu Oct 10 13:47:18 2013 +0200

sal: add special handling of argc==0 to osl_setCommandArgs()

... to set up a fake command line.  This is used from pyuno, when
invoked from the python executable as import uno.

On WNT there is an API to get the actual command line, so just use that
even in the fake case; on UNX just fake something up.

Just for the record the whole osl_setCommandArgs() is called exactly once
assumption should work out _unless_ there is a program that uses SAL_MAIN
_and_ does a python-level import uno _before_ it wants to create a
python-based UNO service (via pyuno_loader::CreateInstance), since
pyuno already takes care to call Runtime::initialize() at most once.

Change-Id: Ifd23de733ea3e6b694d46ab039b6aa4fd3e7fc1b
Signed-off-by: Stephan Bergmann sberg...@redhat.com

diff --git a/pyuno/source/module/pyuno_module.cxx 
b/pyuno/source/module/pyuno_module.cxx
index e34b675..718759f 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -263,10 +263,7 @@ static PyObject* getComponentContext(
 {
 // cppu::defaultBootstrap_InitialComponentContext expects
 // command line arguments to be present
-static char * argv [1];
-argv[0] = strdup(
-this is just a fake and cheap imitation of a command line);
-osl_setCommandArgs(1, argv);
+osl_setCommandArgs(0, 0); // fake it
 
 OUString iniFile;
 if( path.isEmpty() )
diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx
index 00766cc..6d1694d 100644
--- a/sal/osl/unx/process_impl.cxx
+++ b/sal/osl/unx/process_impl.cxx
@@ -208,13 +208,26 @@ oslProcessError SAL_CALL osl_getCommandArg (sal_uInt32 
nArg, rtl_uString ** strC
  **/
 void SAL_CALL osl_setCommandArgs (int argc, char ** argv)
 {
-OSL_ASSERT(argc  0);
+// special case for argc == 0: set up fake command line
+int nArgs(argc ? argc : 1);
 pthread_mutex_lock ((g_command_args.m_mutex));
 assert (g_command_args.m_nCount == 0);
 if (g_command_args.m_nCount == 0)
 {
-rtl_uString** ppArgs = (rtl_uString**)rtl_allocateZeroMemory (argc * 
sizeof(rtl_uString*));
-if (ppArgs != 0)
+rtl_uString** ppArgs =
+(rtl_uString**)rtl_allocateZeroMemory(nArgs * 
sizeof(rtl_uString*));
+if (ppArgs != 0  argc == 0)
+{
+// special case: set up fake command line
+char const*const arg =
+this is just a fake and cheap imitation of a command line;
+rtl_string2UString(ppArgs[0],
+arg, rtl_str_getLength(arg), RTL_TEXTENCODING_ASCII_US,
+OSTRING_TO_OUSTRING_CVTFLAGS);
+g_command_args.m_nCount = nArgs;
+g_command_args.m_ppArgs = ppArgs;
+}
+else if (ppArgs != 0)
 {
 rtl_TextEncoding encoding = osl_getThreadTextEncoding();
 for (int i = 0; i  argc; i++)
diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx
index 920e77d..6d55249 100644
--- a/sal/osl/w32/process.cxx
+++ b/sal/osl/w32/process.cxx
@@ -261,14 +261,14 @@ static struct CommandArgs_Impl g_command_args =
 #endif
 static rtl_uString ** osl_createCommandArgs_Impl (int argc, char **)
 {
+int nArgs(0);
+LPWSTR *wargv = CommandLineToArgvW( GetCommandLineW(), nArgs );
+assert(argc == nArgs || argc == 0 /* special case - faked */);
 rtl_uString ** ppArgs =
-(rtl_uString**)rtl_allocateZeroMemory (argc * sizeof(rtl_uString*));
+(rtl_uString**)rtl_allocateZeroMemory(nArgs * sizeof(rtl_uString*));
 if (ppArgs != 0)
 {
 int i;
-int nArgs;
-LPWSTR *wargv = CommandLineToArgvW( GetCommandLineW(), nArgs );
-OSL_ASSERT( nArgs == argc );
 for (i = 0; i  nArgs; i++)
 {
 /* Convert to unicode */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2013-10-07 Thread David Bolen
 pyuno/source/module/uno.py |   17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit df1076965f63eedc6cc104c96b993ab598b8b1d4
Author: David Bolen db3l@gmail.com
Date:   Sun Oct 6 19:23:14 2013 -0400

fdo#70196: Python 2 compatibility for UNO import error handling

Add backwards compatibility support for Python 2 to the earlier
change in fdo#66025 to improve import error handling under Python 3.

Change-Id: I47bf8ef255c4c2a3e4a2754414977aaa8ed32483
Signed-off-by: Stephan Bergmann sberg...@redhat.com

diff --git a/pyuno/source/module/uno.py b/pyuno/source/module/uno.py
index 2396641..6f8744b 100644
--- a/pyuno/source/module/uno.py
+++ b/pyuno/source/module/uno.py
@@ -310,11 +310,11 @@ def _uno_import( name, *optargs, **kwargs ):
   # uno and non-uno errors as uno lookups are attempted for all
   # from xxx import yyy imports following a python failure.
   #
-  # The traceback from the original python exception is kept to
-  # pinpoint the actual failing location, but in Python 3 the
-  # original message is most likely unhelpful for uno failures,
-  # as it will most commonly be a missing top level module,
-  # like 'com'.  Our exception appends the uno lookup failure.
+  # In Python 3, the original python exception traceback is reused
+  # to help pinpoint the actual failing location.  Its original
+  # message, unlike Python 2, is unlikely to be helpful for uno
+  # failures, as it most commonly is just a top level module like
+  # 'com'.  So our exception appends the uno lookup failure.
   # This is more ambiguous, but it plus the traceback should be
   # sufficient to identify a root cause for python or uno issues.
   #
@@ -327,9 +327,10 @@ def _uno_import( name, *optargs, **kwargs ):
   # keeps the exception relevant to the primary failure point,
   # preventing us from re-processing our own import errors.
 
-  uno_import_exc = ImportError(
-  %s (or '%s.%s' is unknown) % (py_import_exc, name, x)
-  ).with_traceback(py_import_exc.__traceback__)
+  uno_import_exc = ImportError(%s (or '%s.%s' is unknown) %
+   (py_import_exc, name, x))
+  if sys.version_info[0] = 3:
+  uno_import_exc = 
uno_import_exc.with_traceback(py_import_exc.__traceback__)
   uno_import_exc._uno_import_failed = True
   raise uno_import_exc
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2013-08-13 Thread David Bolen
 pyuno/source/module/pyuno.cxx|   65 ++-
 pyuno/source/module/pyuno_impl.hxx   |2 +
 pyuno/source/module/pyuno_module.cxx |2 +
 3 files changed, 45 insertions(+), 24 deletions(-)

New commits:
commit 1be8e912ba8a7d1acaf40d5a8597421c104ab39c
Author: David Bolen db3l@gmail.com
Date:   Fri Aug 9 23:35:27 2013 -0400

fdo#50470: Restore pyuno object method introspection in Python 3

Switch to __dir__ entry point for introspection as Python 3 dropped support
for __members__/__methods__.  This is backwards compatible to Python 2.6.

Module initialization adjusted to complete type setup (needed for tp_dict)
via PyType_Ready.

Change-Id: Ie1f7b9dd4279242de89d009eb7acdc8c786dab8f
Reviewed-on: https://gerrit.libreoffice.org/5375
Reviewed-by: Michael Stahl mst...@redhat.com
Tested-by: Michael Stahl mst...@redhat.com

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 58579eb..7a420a6 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -427,6 +427,32 @@ PyObject *PyUNO_str( PyObject * self )
 return PyStr_FromString( buf.getStr());
 }
 
+PyObject* PyUNO_dir (PyObject* self)
+{
+PyUNO* me = (PyUNO*) self;
+
+PyObject* member_list = NULL;
+SequenceOUString oo_member_list;
+
+try
+{
+oo_member_list = me-members-xInvocation-getMemberNames ();
+member_list = PyList_New (oo_member_list.getLength ());
+for (int i = 0; i  oo_member_list.getLength (); i++)
+{
+// setitem steals a reference
+PyList_SetItem (member_list, i, 
ustring2PyString(oo_member_list[i]).getAcquired() );
+}
+}
+catch( const RuntimeException e )
+{
+raisePyExceptionWithAny( makeAny(e) );
+}
+
+return member_list;
+}
+
+
 PyObject* PyUNO_getattr (PyObject* self, char* name)
 {
 PyUNO* me;
@@ -437,31 +463,10 @@ PyObject* PyUNO_getattr (PyObject* self, char* name)
 Runtime runtime;
 
 me = (PyUNO*) self;
-//Handle Python dir () stuff first...
-if (strcmp (name, __members__) == 0)
-{
-PyObject* member_list;
-SequenceOUString oo_member_list;
-
-oo_member_list = me-members-xInvocation-getMemberNames ();
-member_list = PyList_New (oo_member_list.getLength ());
-for (int i = 0; i  oo_member_list.getLength (); i++)
-{
-// setitem steals a reference
-PyList_SetItem (member_list, i, 
ustring2PyString(oo_member_list[i]).getAcquired() );
-}
-return member_list;
-}
-
 if (strcmp (name, __dict__) == 0)
 {
-Py_INCREF (Py_None);
-return Py_None;
-}
-if (strcmp (name, __methods__) == 0)
-{
-Py_INCREF (Py_None);
-return Py_None;
+Py_INCREF (Py_TYPE(me)-tp_dict);
+return Py_TYPE(me)-tp_dict;
 }
 if (strcmp (name, __class__) == 0)
 {
@@ -638,6 +643,13 @@ static PyObject* PyUNO_cmp( PyObject *self, PyObject 
*that, int op )
 return result;
 }
 
+static PyMethodDef PyUNOMethods[] =
+{
+{__dir__, (PyCFunction)PyUNO_dir, METH_NOARGS, NULL},
+{NULL,  NULL,   0,   NULL}
+};
+
+
 /* Python 2 has a tp_flags value for rich comparisons.  Python 3 does not (on 
by default) */
 #ifdef Py_TPFLAGS_HAVE_RICHCOMPARE
 #define TP_FLAGS (Py_TPFLAGS_HAVE_RICHCOMPARE)
@@ -674,7 +686,7 @@ static PyTypeObject PyUNOType =
 0,
 (getiterfunc)0,
 (iternextfunc)0,
-NULL,
+PyUNOMethods,
 NULL,
 NULL,
 NULL,
@@ -698,6 +710,11 @@ static PyTypeObject PyUNOType =
 #endif
 };
 
+int PyUNO_initType()
+{
+return PyType_Ready(PyUNOType);
+}
+
 PyRef getPyUnoClass()
 {
 return PyRef( reinterpret_cast PyObject *  ( PyUNOType ) );
diff --git a/pyuno/source/module/pyuno_impl.hxx 
b/pyuno/source/module/pyuno_impl.hxx
index b114b3c..1222bf3 100644
--- a/pyuno/source/module/pyuno_impl.hxx
+++ b/pyuno/source/module/pyuno_impl.hxx
@@ -188,6 +188,8 @@ typedef ::boost::unordered_map
 
 typedef ::boost::unordered_set PyRef , PyRef::Hash , std::equal_toPyRef  
ClassSet;
 
+int PyUNO_initType();
+
 PyObject* PyUNO_new(
 const com::sun::star::uno::Any  targetInterface,
 const 
com::sun::star::uno::Referencecom::sun::star::lang::XSingleServiceFactory  
ssf);
diff --git a/pyuno/source/module/pyuno_module.cxx 
b/pyuno/source/module/pyuno_module.cxx
index cb8fd95..1e812d1 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -867,6 +867,7 @@ extern C
 #if PY_MAJOR_VERSION = 3
 PyObject* PyInit_pyuno()
 {
+PyUNO_initType();
 // noop when called already, otherwise needed to allow multiple threads
 PyEval_InitThreads();
 static struct PyModuleDef moduledef =
@@ -886,6 +887,7 @@ PyObject* PyInit_pyuno()
 #else
 

[Libreoffice-commits] core.git: pyuno/source

2013-07-24 Thread David Bolen
 pyuno/source/module/uno.py |   39 +++
 1 file changed, 31 insertions(+), 8 deletions(-)

New commits:
commit 7fd81244c21ad54a8b9766902fd7c34e8055b165
Author: David Bolen db3l@gmail.com
Date:   Wed Jul 24 09:57:03 2013 +0200

fdo#66025: Improve ImportError raised from _uno_import

Change-Id: I92301f0c37d69e5977a12ab4d5a360f7a4ff20fe
Signed-off-by: Stephan Bergmann sberg...@redhat.com

diff --git a/pyuno/source/module/uno.py b/pyuno/source/module/uno.py
index 86011f3..62ad01f 100644
--- a/pyuno/source/module/uno.py
+++ b/pyuno/source/module/uno.py
@@ -263,7 +263,7 @@ def _uno_import( name, *optargs, **kwargs ):
 try:
 #   print optargs =  + repr(optargs)
 return _g_delegatee( name, *optargs, **kwargs )
-except ImportError:
+except ImportError as e:
 # process optargs
 globals, locals, fromlist = list(optargs)[:3] + 
[kwargs.get('globals',{}), kwargs.get('locals',{}), 
kwargs.get('fromlist',[])][len(optargs):]
 if not fromlist:
@@ -279,28 +279,51 @@ def _uno_import( name, *optargs, **kwargs ):
 d = mod.__dict__
 
 RuntimeException = pyuno.getClass( com.sun.star.uno.RuntimeException )
+unknown = object() # unknown/missing sentinel
 for x in fromlist:
if x not in d:
+  d[x] = unknown
   if x.startswith( typeOf ):
  try: 
 d[x] = pyuno.getTypeByName( name + . + x[6:len(x)] )
- except RuntimeException as e:
-raise ImportError( type  + name + . + x[6:len(x)] + is 
unknown )
+ except RuntimeException:
+pass
   else:
 try:
 # check for structs, exceptions or interfaces
 d[x] = pyuno.getClass( name + . + x )
-except RuntimeException as e:
+except RuntimeException:
 # check for enums 
 try:
d[x] = Enum( name , x )
-except RuntimeException as e2:
+except RuntimeException:
# check for constants
try:
   d[x] = getConstantByName( name + . + x )
-   except RuntimeException as e3:
-  # no known uno type !
-  raise ImportError( type + name + . +x +  is 
unknown )
+   except RuntimeException:
+  pass
+
+  if d[x] is unknown:
+ # Remove unknown placeholder we created
+ del d[x]
+
+ # This can be a bad uno reference, or it can just result from any
+ # python import failure (in a from xxx import yyy statement).
+ # Synthesize a general purpose exception, reusing the original
+ # traceback to provide information for either case.  We don't use
+ # the original python exception as uno failures will typically
+ # just reflect a missing top level module (such as com).
+
+ # Note that we raise this outside of the nested exception handlers
+ # above, or otherwise Python 3 will generate additional tracebacks
+ # for each of the nested exceptions.
+
+ e = ImportError(No module named '%s' or '%s.%s' is unknown %
+ (name, name, x))
+ e.__traceback__ = sys.exc_info()[2]
+
+ raise e
+
 return mod
 
 # private function, don't use
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2013-07-24 Thread David Bolen
 pyuno/source/module/uno.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 329125abb63061214897e4f215d41cfa4b13b4b0
Author: David Bolen db3l@gmail.com
Date:   Wed Jul 24 13:03:48 2013 +0200

fdo#66025: Minor clean-up of previous patch

Change-Id: Idaaf8ebbf419899ba04b77cf10b217c141652a3a
Signed-off-by: Stephan Bergmann sberg...@redhat.com

diff --git a/pyuno/source/module/uno.py b/pyuno/source/module/uno.py
index 62ad01f..d5da804 100644
--- a/pyuno/source/module/uno.py
+++ b/pyuno/source/module/uno.py
@@ -263,7 +263,7 @@ def _uno_import( name, *optargs, **kwargs ):
 try:
 #   print optargs =  + repr(optargs)
 return _g_delegatee( name, *optargs, **kwargs )
-except ImportError as e:
+except ImportError:
 # process optargs
 globals, locals, fromlist = list(optargs)[:3] + 
[kwargs.get('globals',{}), kwargs.get('locals',{}), 
kwargs.get('fromlist',[])][len(optargs):]
 if not fromlist:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2013-07-24 Thread David Bolen
 pyuno/source/module/uno.py |   12 
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit fbe28de6fbfdce41544e4e93168d32661add8285
Author: David Bolen db3l@gmail.com
Date:   Wed Jul 24 07:07:14 2013 -0400

fdo#66025: Simplify new ImportError logic

Signed-off-by: Stephan Bergmann sberg...@redhat.com

diff --git a/pyuno/source/module/uno.py b/pyuno/source/module/uno.py
index d5da804..15af94a 100644
--- a/pyuno/source/module/uno.py
+++ b/pyuno/source/module/uno.py
@@ -279,15 +279,14 @@ def _uno_import( name, *optargs, **kwargs ):
 d = mod.__dict__
 
 RuntimeException = pyuno.getClass( com.sun.star.uno.RuntimeException )
-unknown = object() # unknown/missing sentinel
 for x in fromlist:
if x not in d:
-  d[x] = unknown
+  failed = False
   if x.startswith( typeOf ):
  try: 
 d[x] = pyuno.getTypeByName( name + . + x[6:len(x)] )
  except RuntimeException:
-pass
+failed = True
   else:
 try:
 # check for structs, exceptions or interfaces
@@ -301,12 +300,9 @@ def _uno_import( name, *optargs, **kwargs ):
try:
   d[x] = getConstantByName( name + . + x )
except RuntimeException:
-  pass
-
-  if d[x] is unknown:
- # Remove unknown placeholder we created
- del d[x]
+  failed = True
 
+  if failed:
  # This can be a bad uno reference, or it can just result from any
  # python import failure (in a from xxx import yyy statement).
  # Synthesize a general purpose exception, reusing the original
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2013-07-12 Thread Herbert Dürr
 pyuno/source/module/pyuno.cxx  |6 +-
 pyuno/source/module/pyuno_callable.cxx |6 --
 pyuno/source/module/pyuno_impl.hxx |2 --
 3 files changed, 1 insertion(+), 13 deletions(-)

New commits:
commit 28a4496c76acdab6cb851387e78366bb611f130f
Author: Herbert Dürr h...@apache.org
Date:   Fri Jul 12 09:10:27 2013 +

Resolves: #i120788# remove unused members from PyUNO_callable_Internals

Patch by: Tsutomu Uchino hanya.r...@gmail.com

(cherry picked from commit 5e2c3fd88906494965979bd20ca852391bee3bac)

Conflicts:
pyuno/source/module/pyuno_impl.hxx

Change-Id: If73d5f7b799f04b79b5cc71d2d44c797851b18d0

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 4c6191d..58579eb 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -342,8 +342,6 @@ PyObject *PyUNO_invoke( PyObject *object, const char *name 
, PyObject *args )
 callable = PyUNO_callable_new (
 me-members-xInvocation,
 attrName,
-runtime.getImpl()-cargo-xInvocation,
-runtime.getImpl()-cargo-xTypeConverter,
 ACCEPT_UNO_ANY);
 paras = args;
 }
@@ -486,9 +484,7 @@ PyObject* PyUNO_getattr (PyObject* self, char* name)
 //Create a callable object to invoke this...
 PyRef ret = PyUNO_callable_new (
 me-members-xInvocation,
-attrName,
-runtime.getImpl()-cargo-xInvocation,
-runtime.getImpl()-cargo-xTypeConverter);
+attrName);
 Py_XINCREF( ret.get() );
 return ret.get();
 
diff --git a/pyuno/source/module/pyuno_callable.cxx 
b/pyuno/source/module/pyuno_callable.cxx
index 4175c80..24cae2c 100644
--- a/pyuno/source/module/pyuno_callable.cxx
+++ b/pyuno/source/module/pyuno_callable.cxx
@@ -38,8 +38,6 @@ namespace pyuno
 typedef struct
 {
 ReferenceXInvocation2 xInvocation;
-ReferenceXSingleServiceFactory xInvocationFactory;
-ReferenceXTypeConverter xTypeConverter;
 OUString methodName;
 ConversionMode mode;
 } PyUNO_callable_Internals;
@@ -240,8 +238,6 @@ static PyTypeObject PyUNO_callable_Type =
 PyRef PyUNO_callable_new (
 const ReferenceXInvocation2 my_inv,
 const OUString  methodName,
-const ReferenceXSingleServiceFactory xInvocationFactory,
-const ReferenceXTypeConverter tc,
 enum ConversionMode mode )
 {
 PyUNO_callable* self;
@@ -255,8 +251,6 @@ PyRef PyUNO_callable_new (
 self-members = new PyUNO_callable_Internals;
 self-members-xInvocation = my_inv;
 self-members-methodName = methodName;
-self-members-xInvocationFactory = xInvocationFactory;
-self-members-xTypeConverter = tc;
 self-members-mode = mode;
 
 return PyRef( (PyObject*)self, SAL_NO_ACQUIRE );
diff --git a/pyuno/source/module/pyuno_impl.hxx 
b/pyuno/source/module/pyuno_impl.hxx
index 9524523..b114b3c 100644
--- a/pyuno/source/module/pyuno_impl.hxx
+++ b/pyuno/source/module/pyuno_impl.hxx
@@ -227,8 +227,6 @@ com::sun::star::uno::TypeClass StringToTypeClass (char* 
string);
 PyRef PyUNO_callable_new (
 const com::sun::star::uno::Referencecom::sun::star::script::XInvocation2 
xInv,
 const OUString methodName,
-const 
com::sun::star::uno::Referencecom::sun::star::lang::XSingleServiceFactory 
ssf,
-const 
com::sun::star::uno::Referencecom::sun::star::script::XTypeConverter tc,
 ConversionMode mode = REJECT_UNO_ANY );
 
 PyObject* PyUNO_Type_new (const char *typeName , 
com::sun::star::uno::TypeClass t , const Runtime r );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2013-06-16 Thread Xiaoli
 pyuno/source/module/pyuno_except.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 7441d4bbdbbcb87193c32510f3577a0e531467e5
Author: Xiaoli duan19002...@gmail.com
Date:   Sun Jun 16 15:31:00 2013 +0200

PyUno fixed crash in function isInstanceOfStructOrException()

when we try to call PyUNO_callable object that doesn't have __class__ 
attribute

Change-Id: Ia05f70d70f248d50aa141b09625f7ec50189e1dd
Reviewed-on: https://gerrit.libreoffice.org/4309
Reviewed-by: Michael Stahl mst...@redhat.com
Tested-by: Michael Stahl mst...@redhat.com

diff --git a/pyuno/source/module/pyuno_except.cxx 
b/pyuno/source/module/pyuno_except.cxx
index 9c21a9e..cf02bd0 100644
--- a/pyuno/source/module/pyuno_except.cxx
+++ b/pyuno/source/module/pyuno_except.cxx
@@ -200,8 +200,10 @@ bool isInstanceOfStructOrException( PyObject *obj)
 PyRef attr(
 PyObject_GetAttrString(obj, __class__),
 SAL_NO_ACQUIRE );
-return PyObject_HasAttrString(
-attr.get(), __pyunostruct__);
+if(attr.is())
+return PyObject_HasAttrString(attr.get(), __pyunostruct__);
+else
+return false;
 }
 
 sal_Bool isInterfaceClass( const Runtime runtime, PyObject * obj )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source

2013-04-09 Thread Stephan Bergmann
 pyuno/source/module/pyuno_module.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4eccc3798b54b90d3d10dc5d5c1347ec69934915
Author: Stephan Bergmann sberg...@redhat.com
Date:   Tue Apr 9 12:33:56 2013 +0200

warning C4101: 'e' : unreferenced local variable

Change-Id: I2828021d60d82e43358ba98a1a3b4967a6901cd6

diff --git a/pyuno/source/module/pyuno_module.cxx 
b/pyuno/source/module/pyuno_module.cxx
index 4403e1a..9662958 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -354,7 +354,7 @@ static PyObject* initPoniesMode(
 // guess casting pFunc is undefined behavior but don't see a better way
 ((void (SAL_CALL *)(XMultiServiceFactory*)) pFunc) (xMSF.get());
 }
-catch (const com::sun::star::uno::Exception  e)
+catch (const com::sun::star::uno::Exception )
 {
 abort();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/source solenv/gbuild sw/PythonTest_sw_unoapi.mk sw/qa test/inc test/source unotest/source

2013-04-08 Thread Michael Stahl
 pyuno/source/module/pyuno_module.cxx |   42 +++
 solenv/gbuild/PythonTest.mk  |   84 +++
 sw/PythonTest_sw_unoapi.mk   |   39 ++
 sw/qa/unoapi/python/get_expression.py|2 
 sw/qa/unoapi/python/set_expression.py|2 
 test/inc/test/bootstrapfixture.hxx   |3 
 test/source/bootstrapfixture.cxx |   43 +--
 unotest/source/python/org/libreoffice/unotest.py |   31 
 8 files changed, 222 insertions(+), 24 deletions(-)

New commits:
commit ebeae438dbaa3e9f1cda33a17c4a6530feac80d9
Author: Michael Stahl mst...@redhat.com
Date:   Fri Apr 5 23:07:18 2013 +0200

move Python tests in-process

This is nice to make them more easily debuggable.
A series of crude hacks are employed to bootstrap enough services from
python so the current tests run.
This is only tested with system python3 on Fedora.

Change-Id: I5e06741e55ead7fddec41ff776ff8ca5d2399469
Reviewed-on: https://gerrit.libreoffice.org/3215
Reviewed-by: David Ostrovsky david.ostrov...@gmx.de
Tested-by: David Ostrovsky david.ostrov...@gmx.de

diff --git a/pyuno/source/module/pyuno_module.cxx 
b/pyuno/source/module/pyuno_module.cxx
index 768b6d7..62851c4 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -320,6 +320,47 @@ static PyObject* getComponentContext(
 return ret.getAcquired();
 }
 
+static PyObject* initPoniesMode(
+SAL_UNUSED_PARAMETER PyObject*, SAL_UNUSED_PARAMETER PyObject*)
+{
+// this tries to bootstrap enough of the soffice from python to run
+// unit tests, which is only possible indirectly because pyuno is URE
+// so load test library and invoke a function there to do the work
+try
+{
+PyObject *const ctx(getComponentContext(0, 0));
+if (!ctx) { abort(); }
+Runtime const runtime;
+Any const a(runtime.pyObject2Any(ctx));
+ReferenceXComponentContext xContext;
+a = xContext;
+if (!xContext.is()) { abort(); }
+using com::sun::star::lang::XMultiServiceFactory;
+ReferenceXMultiServiceFactory const xMSF(
+xContext-getServiceManager(),
+com::sun::star::uno::UNO_QUERY_THROW);
+if (!xMSF.is()) { abort(); }
+char *const outdir = getenv(OUTDIR);
+if (!outdir) { abort(); }
+OStringBuffer libname(outdir);
+libname.append(/lib/);
+libname.append(SAL_DLLPREFIX test SAL_DLLEXTENSION);
+oslModule const mod( osl_loadModuleAscii(libname.getStr(),
+SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL) );
+if (!mod) { abort(); }
+oslGenericFunction const pFunc(
+osl_getAsciiFunctionSymbol(mod, test_init));
+if (!pFunc) { abort(); }
+// guess casting pFunc is undefined behavior but don't see a better way
+((void (SAL_CALL *)(XMultiServiceFactory*)) pFunc) (xMSF.get());
+}
+catch (const com::sun::star::uno::Exception  e)
+{
+abort();
+}
+return Py_None;
+}
+
 PyObject * extractOneStringArg( PyObject *args, char const *funcName )
 {
 if( !PyTuple_Check( args ) || PyTuple_Size( args) != 1 )
@@ -797,6 +838,7 @@ static PyObject *setCurrentContext(
 
 struct PyMethodDef PyUNOModule_methods [] =
 {
+{experimentalExtraMagic, initPoniesMode, METH_VARARGS, NULL},
 {getComponentContext, getComponentContext, METH_VARARGS, NULL},
 {_createUnoStructHelper, 
reinterpret_castPyCFunction(createUnoStructHelper), METH_VARARGS | 
METH_KEYWORDS, NULL},
 {getTypeByName, getTypeByName, METH_VARARGS, NULL},
diff --git a/solenv/gbuild/PythonTest.mk b/solenv/gbuild/PythonTest.mk
index d97b2a8..cb018b1 100644
--- a/solenv/gbuild/PythonTest.mk
+++ b/solenv/gbuild/PythonTest.mk
@@ -27,25 +27,83 @@ ifneq ($(DISABLE_PYTHON),TRUE)
 $(call gb_PythonTest_get_target,%) :
$(call gb_Output_announce,$*,$(true),PYT,2)
$(call gb_Helper_abbreviate_dirs,\
-mkdir -p $(dir $(call gb_PythonTest_get_target,$*))  \
-
(PYTHONPATH=$(SRCDIR)/unotest/source/python:$(DEVINSTALLDIR)/opt/program \
- SOFFICE_BIN=$(DEVINSTALLDIR)/opt/program/soffice \
- URE_BOOTSTRAP=file://$(DEVINSTALLDIR)/opt/program/fundamentalrc \
-   $(gb_PythonTest_COMMAND) \
-$(CLASSES)  $@.log 21 || \
-   (cat $@.log \
-false)))
-   $(CLEAN_CMD)
-
+   mkdir -p $(dir $(call gb_PythonTest_get_target,$*))  \
+   
(PYTHONPATH=$(SRCDIR)/unotest/source/python:$(DEVINSTALLDIR)/opt/program \
+   UserInstallation=$(call 
gb_Helper_make_url,$(OUTDIR)/unittest) \
+   BRAND_BASE_DIR=$(call 
gb_Helper_make_url,$(OUTDIR)/unittest/install) \
+   CONFIGURATION_LAYERS=$(strip $(CONFIGURATION_LAYERS)) \
+   UNO_TYPES=$(foreach 

[Libreoffice-commits] core.git: pyuno/source

2013-03-04 Thread Julien Nabet
 pyuno/source/module/pyuno_dlopenwrapper.c |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 76fb62755b7b7cafe072e62443a5de852caf1da9
Author: Julien Nabet serval2...@yahoo.fr
Date:   Mon Mar 4 21:26:36 2013 +0100

coverity#983056: Resource leak

Change-Id: Ic40776f3cec5139e7f7accb4985533e78bd7c158

diff --git a/pyuno/source/module/pyuno_dlopenwrapper.c 
b/pyuno/source/module/pyuno_dlopenwrapper.c
index 8176656..c726635 100644
--- a/pyuno/source/module/pyuno_dlopenwrapper.c
+++ b/pyuno/source/module/pyuno_dlopenwrapper.c
@@ -68,6 +68,7 @@ static void * load(void * address, char const * symbol) {
 }
 func = dlsym(h, symbol);
 if (func == NULL) {
+dlclose(h);
 abort();
 }
 return func;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits