[Libreoffice-commits] core.git: 2 commits - python3/python-3.3.0-pythreadstate.patch.1 python3/UnpackedTarball_python3.mk pyuno/source
Michael Stahl
mstahl at redhat.com
Thu Apr 18 09:27:34 PDT 2013
python3/UnpackedTarball_python3.mk | 1 +
python3/python-3.3.0-pythreadstate.patch.1 | 15 +++++++++++++++
pyuno/source/loader/pyuno_loader.cxx | 4 ++++
3 files changed, 20 insertions(+)
New commits:
commit e83990a87281f2472f398be9267f7b11f7f8463e
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Apr 18 12:23:22 2013 +0200
python3: disable check in PyThreadState_Swap
This check is triggered by nested pyuno PyThreadAttach instances.
The assertion is basically about having multiple PyThreadState instances
per OS thread. Hopefully this is not a "real" problem and the other
checks in PyEval_ReleaseThread/PyEval_AcquireThread will find all "real"
problems.
http://www.mail-archive.com/libreoffice@lists.freedesktop.org/msg62195.html
Change-Id: Ia82135f37f55ea69b545a83098619939869cb7c5
Reviewed-on: https://gerrit.libreoffice.org/3453
Reviewed-by: David Ostrovsky <David.Ostrovsky at gmx.de>
Tested-by: David Ostrovsky <David.Ostrovsky at gmx.de>
diff --git a/python3/UnpackedTarball_python3.mk b/python3/UnpackedTarball_python3.mk
index 87adff0..696c869 100644
--- a/python3/UnpackedTarball_python3.mk
+++ b/python3/UnpackedTarball_python3.mk
@@ -31,6 +31,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,python3,\
python3/python-3.3.0-implicit-int.patch.1 \
python3/python-3.3.0-ffi-clang.patch.1 \
python3/python-3.3.0-gcc-4.8.patch.1 \
+ python3/python-3.3.0-pythreadstate.patch.1 \
))
ifneq ($(OS),WNT)
diff --git a/python3/python-3.3.0-pythreadstate.patch.1 b/python3/python-3.3.0-pythreadstate.patch.1
new file mode 100644
index 0000000..66350e2
--- /dev/null
+++ b/python3/python-3.3.0-pythreadstate.patch.1
@@ -0,0 +1,15 @@
+disable a check in PyThreadState_Swap that is hopefully not a "real" problem
+
+--- python3/Python/pystate.c 2013-04-17 22:45:00.799800000 +0200
++++ python3/Python/pystate.c 2013-04-17 22:46:53.743800000 +0200
+@@ -437,7 +437,9 @@
+ to be used for a thread. Check this the best we can in debug
+ builds.
+ */
+-#if defined(Py_DEBUG) && defined(WITH_THREAD)
++#if defined(Py_DEBUG) && defined(WITH_THREAD) && 0
++ /* disable this for LO - it is triggered by nested PyThreadAttach
++ which do not appear to be a real problem */
+ if (newts) {
+ /* This can be called from PyEval_RestoreThread(). Similar
+ to it, we need to ensure errno doesn't change.
commit 1fb53a637597f76bea86514b62ddfad34f60c889
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Apr 18 12:38:42 2013 +0200
pyuno_loader::CreateInstance: delete the initial PyThreadState
Don't see how it could be used again, it appears to be leaked
and causes the assertion in PyThreadState_Swap to fire.
Change-Id: Id6bbb4363928e4fdd8bda1905f6e1f9931dba74c
Reviewed-on: https://gerrit.libreoffice.org/3452
Reviewed-by: David Ostrovsky <David.Ostrovsky at gmx.de>
Tested-by: David Ostrovsky <David.Ostrovsky at gmx.de>
diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx
index 0db1b9b..718edc7 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -223,6 +223,10 @@ Reference< XInterface > CreateInstance( const Reference< XComponentContext > & c
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.
+ PyThreadState_Delete(tstate);
}
PyThreadAttach attach( PyInterpreterState_Head() );
More information about the Libreoffice-commits
mailing list