[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - bin/check-elf-dynamic-objects configure.ac download.lst external/openssl external/python3 pyuno/inc pyuno/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 8 10:33:48 UTC 2020


 bin/check-elf-dynamic-objects                          |    6 
 configure.ac                                           |    4 
 download.lst                                           |    4 
 external/openssl/ExternalProject_openssl.mk            |    2 
 external/python3/ExternalPackage_python3.mk            |   77 ++++----
 external/python3/ExternalProject_python3.mk            |   16 +
 external/python3/UnpackedTarball_python3.mk            |   13 -
 external/python3/i100492-freebsd.patch.1               |   45 -----
 external/python3/python-3.3.0-pythreadstate.patch.1    |   15 -
 external/python3/python-3.3.3-aix.patch.1              |  146 -----------------
 external/python3/python-3.3.3-disable-obmalloc.patch.0 |   19 --
 external/python3/python-3.3.3-elf-rpath.patch.1        |    9 -
 external/python3/python-3.5.4-msvc-disable.patch.1     |   15 -
 external/python3/python-3.5.4-ssl.patch.1              |   83 ---------
 external/python3/python-3.7.6-msvc-ssl.patch.1         |   25 ++
 external/python3/python3-osx-avoid-new-10.13.patch.1   |   61 -------
 external/python3/ubsan.patch.0                         |   22 --
 pyuno/inc/pyuno.hxx                                    |    1 
 pyuno/source/module/pyuno.cxx                          |    9 -
 pyuno/source/module/pyuno_runtime.cxx                  |   31 +++
 20 files changed, 138 insertions(+), 465 deletions(-)

New commits:
commit 853cc90f49d59a94242494c4aee2479de0865486
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Dec 9 14:08:19 2019 +0100
Commit:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
CommitDate: Wed Jan 8 11:33:15 2020 +0100

    python3: upgrade to release 3.7.6
    
    * external/python3/python-3.3.3-aix.patch.1:
      most of it doesn't apply and AIX port isn't maintained anyway so
      remove it for now
    * external/python3/ubsan.patch.0:
      apparently one of the files was removed
    * 0001-3.6-bpo-17239-Disable-external-entities-in-SAX-parse.patch.1:
      fixed upstream
    * python3-osx-avoid-new-10.13.patch.1:
      replace with simply passing ac_cv_func_utimensat=no to configure
    * external/python3/python-3.5.4-ssl.patch.1:
      project files to build OpenSSL removed upstream
    * There have been changes to how python locates OpenSSL; new variables
      OPENSSL_INCLUDES etc; it turns out that you have to pass one directory
      to --with-openssl, as the variables cannot be passed
    * libuuid.so.1 is a new dependency of the _uuid module
    * libffi.so.6 is a new dependency of the _ctypes module (the bundled
      copy of libffi for non-Darwin platforms was removed)
    * python-3.3.0-pythreadstate.patch.1:
      the PyThreadState functions have been changed such that
      CppunitTest_services asserts when there is a PyThreadAttach on top of
      PyThreadDetach on top of PyThreadAttach, i.e., 2 PyThreadState per
      thread (PyGILState_Check() fails).  Instead of patching in additional
      workarounds, change PyThreadAttach so that it re-uses an existing
      PyThreadState if one exists for the thread.
    
    Change-Id: I24c19d79b43a30709261fd9db66312b2e3872fd9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/84765
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit b10be5d48433076f0b7238d818020f708553e114)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86398
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/bin/check-elf-dynamic-objects b/bin/check-elf-dynamic-objects
index 45bd0ecf45c6..d1b7ab5522f4 100755
--- a/bin/check-elf-dynamic-objects
+++ b/bin/check-elf-dynamic-objects
@@ -111,6 +111,12 @@ local file="$1"
             # skip the majority of files, no ELF binaries here
             skip=1
         ;;
+        */_ctypes.cpython-*.so)
+            whitelist="${whitelist} libffi.so.6" # TODO dubious?
+        ;;
+        */_uuid.cpython-*.so)
+            whitelist="${whitelist} libuuid.so.1"
+        ;;
         */libcairo.so.2)
             whitelist="${whitelist} ${x11whitelist} libxcb-shm.so.0 libxcb.so.1 libxcb-render.so.0"
         ;;
diff --git a/configure.ac b/configure.ac
index 049e20b774ac..4a4e3821b844 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8758,8 +8758,8 @@ int main(int argc, char **argv) {
 internal)
     SYSTEM_PYTHON=
     PYTHON_VERSION_MAJOR=3
-    PYTHON_VERSION_MINOR=5
-    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.9
+    PYTHON_VERSION_MINOR=7
+    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.6
     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
     fi
diff --git a/download.lst b/download.lst
index f023795fcc1f..f1769774540a 100644
--- a/download.lst
+++ b/download.lst
@@ -210,8 +210,8 @@ export POPPLER_SHA256SUM := 234f8e573ea57fb6a008e7c1e56bfae1af5d1adf0e65f47555e1
 export POPPLER_TARBALL := poppler-0.82.0.tar.xz
 export POSTGRESQL_SHA256SUM := a754c02f7051c2f21e52f8669a421b50485afcde9a581674d6106326b189d126
 export POSTGRESQL_TARBALL := postgresql-9.2.24.tar.bz2
-export PYTHON_SHA256SUM := c24a37c63a67f53bdd09c5f287b5cff8e8b98f857bf348c577d454d3f74db049
-export PYTHON_TARBALL := Python-3.5.9.tar.xz
+export PYTHON_SHA256SUM := 55a2cce72049f0794e9a11a84862e9039af9183603b78bc60d89539f82cf533f
+export PYTHON_TARBALL := Python-3.7.6.tar.xz
 export QRCODEGEN_SHA256SUM := fcdf9fd69fde07ae4dca2351d84271a9de8093002f733b77c70f52f1630f6e4a
 export QRCODEGEN_TARBALL := QR-Code-generator-1.4.0.tar.gz
 export QXP_SHA256SUM := e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
diff --git a/external/openssl/ExternalProject_openssl.mk b/external/openssl/ExternalProject_openssl.mk
index 24eab4ccfe58..5f5fb42c5eef 100644
--- a/external/openssl/ExternalProject_openssl.mk
+++ b/external/openssl/ExternalProject_openssl.mk
@@ -84,7 +84,9 @@ $(call gb_ExternalProject_get_state_target,openssl,build):
 			CC="$(CC) -fPIC \
 				$(if $(filter TRUE, $(ENABLE_DBGUTIL)), -DPURIFY,) \
 				$(if $(filter-out WNT MACOSX,$(OS)),-fvisibility=hidden)" \
+		&& ln -s . lib \
 	)
+# symlink lib dir for python3
 endif
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/python3/ExternalPackage_python3.mk b/external/python3/ExternalPackage_python3.mk
index dc3d739c295b..60eeb022160c 100644
--- a/external/python3/ExternalPackage_python3.mk
+++ b/external/python3/ExternalPackage_python3.mk
@@ -54,9 +54,11 @@ $(eval $(call gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/libpython$(
 ifneq ($(OS),AIX)
 $(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/lib-dynload,\
 	LO_lib/array.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
+	LO_lib/_asyncio.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/audioop.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/binascii.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_bisect.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
+	LO_lib/_blake2.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/cmath.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_codecs_cn.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_codecs_hk.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
@@ -64,6 +66,7 @@ $(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-cor
 	LO_lib/_codecs_jp.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_codecs_kr.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_codecs_tw.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
+	LO_lib/_contextvars.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_crypt.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_csv.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_ctypes.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
@@ -80,6 +83,7 @@ $(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-cor
 	LO_lib/_json.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_lsprof.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/math.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
+	LO_lib/_md5.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/mmap.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_multibytecodec.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_multiprocessing.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
@@ -89,11 +93,13 @@ $(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-cor
 	LO_lib/_pickle.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_posixsubprocess.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/pyexpat.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
+	LO_lib/_queue.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_random.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/resource.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/select.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_sha1.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_sha256.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
+	LO_lib/_sha3.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_sha512.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_socket.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/spwd.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
@@ -108,7 +114,9 @@ $(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-cor
 	LO_lib/_testimportmultiple.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_testmultiphase.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/unicodedata.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
+	LO_lib/_uuid.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/xxlimited.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
+	LO_lib/_xxtestfuzz.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/zlib.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 ))
 endif
@@ -117,10 +125,20 @@ endif
 # headers are not delivered, but used from unpacked dir Include/
 # (+ toplevel for pyconfig.h)
 
+ifeq ($(OS),LINUX)
+python3_MACHDEP=linux
+else
+ifeq ($(OS),MACOSX)
+python3_MACHDEP=darwin
+endif
+endif
+
 # that one is generated...
+# note: python configure overrides config.guess with something that doesn't
+# put -pc in its linux platform triplets, so filter that...
 ifneq ($(OS),WNT)
 $(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib,\
-	LO_lib/_sysconfigdata.py \
+	LO_lib/_sysconfigdata_m_$(python3_MACHDEP)_$(subst -pc,,$(HOST_PLATFORM)).py \
 ))
 endif
 
@@ -131,33 +149,6 @@ endif
 # test - probably unnecessary? was explicitly removed #i116738#
 # venv - why would we need virtual environments
 
-$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/plat-linux,\
-	Lib/plat-linux/regen \
-	Lib/plat-linux/CDROM.py \
-	Lib/plat-linux/DLFCN.py \
-	Lib/plat-linux/IN.py \
-	Lib/plat-linux/TYPES.py \
-))
-
-$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/plat-darwin,\
-	Lib/plat-darwin/IN.py \
-	Lib/plat-darwin/regen \
-))
-
-$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/plat-sunos5,\
-	Lib/plat-sunos5/regen \
-	Lib/plat-sunos5/CDIO.py \
-	Lib/plat-sunos5/DLFCN.py \
-	Lib/plat-sunos5/IN.py \
-	Lib/plat-sunos5/STROPTS.py \
-	Lib/plat-sunos5/TYPES.py \
-))
-
-$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/plat-aix4,\
-	Lib/plat-aix4/regen \
-	Lib/plat-aix4/IN.py \
-))
-
 $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib,\
 	LICENSE \
 	Lib/__future__.py \
@@ -199,11 +190,13 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/compileall.py \
 	Lib/configparser.py \
 	Lib/contextlib.py \
+	Lib/contextvars.py \
 	Lib/copy.py \
 	Lib/copyreg.py \
 	Lib/cProfile.py \
 	Lib/crypt.py \
 	Lib/csv.py \
+	Lib/dataclasses.py \
 	Lib/datetime.py \
 	Lib/decimal.py \
 	Lib/difflib.py \
@@ -238,7 +231,6 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/locale.py \
 	Lib/lzma.py \
 	Lib/macpath.py \
-	Lib/macurl2path.py \
 	Lib/mailbox.py \
 	Lib/mailcap.py \
 	Lib/mimetypes.py \
@@ -267,6 +259,7 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/pstats.py \
 	Lib/pty.py \
 	Lib/pyclbr.py \
+	Lib/_py_abc.py \
 	Lib/py_compile.py \
 	Lib/pydoc.py \
 	Lib/queue.py \
@@ -277,6 +270,7 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/rlcompleter.py \
 	Lib/runpy.py \
 	Lib/sched.py \
+	Lib/secrets.py \
 	Lib/shelve.py \
 	Lib/selectors.py \
 	Lib/shlex.py \
@@ -318,17 +312,6 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/turtle.py \
 	Lib/types.py \
 	Lib/typing.py \
-	Lib/unittest/case.py \
-	Lib/unittest/__init__.py \
-	Lib/unittest/loader.py \
-	Lib/unittest/__main__.py \
-	Lib/unittest/main.py \
-	Lib/unittest/mock.py \
-	Lib/unittest/result.py \
-	Lib/unittest/runner.py \
-	Lib/unittest/signals.py \
-	Lib/unittest/suite.py \
-	Lib/unittest/util.py \
 	Lib/uu.py \
 	Lib/uuid.py \
 	Lib/warnings.py \
@@ -339,9 +322,15 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/zipfile.py \
 ))
 
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/asyncio,\
+	Lib/asyncio/base_futures.py \
+	Lib/asyncio/base_tasks.py \
+	Lib/asyncio/format_helpers.py \
+	Lib/asyncio/runners.py \
+))
+
 $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/collections,\
 	Lib/collections/__init__.py \
-	Lib/collections/__main__.py \
 	Lib/collections/abc.py \
 ))
 
@@ -358,6 +347,7 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 
 $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/ctypes,\
 	Lib/ctypes/__init__.py \
+	Lib/ctypes/_aix.py \
 	Lib/ctypes/_endian.py \
 	Lib/ctypes/util.py \
 	Lib/ctypes/wintypes.py \
@@ -577,6 +567,7 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/encodings/mac_roman.py \
 	Lib/encodings/mac_turkish.py \
 	Lib/encodings/mbcs.py \
+	Lib/encodings/oem.py \
 	Lib/encodings/palmos.py \
 	Lib/encodings/ptcp154.py \
 	Lib/encodings/punycode.py \
@@ -623,6 +614,7 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/importlib/_bootstrap_external.py \
 	Lib/importlib/abc.py \
 	Lib/importlib/machinery.py \
+	Lib/importlib/resources.py \
 	Lib/importlib/util.py \
 ))
 
@@ -800,6 +792,7 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/unittest/test/testmock/testmagicmethods.py \
 	Lib/unittest/test/testmock/testmock.py \
 	Lib/unittest/test/testmock/testpatch.py \
+	Lib/unittest/test/testmock/testsealable.py \
 	Lib/unittest/test/testmock/testsentinel.py \
 	Lib/unittest/test/testmock/testwith.py \
 ))
@@ -866,7 +859,7 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 ))
 
 $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/site-packages,\
-	Lib/site-packages/README \
+	Lib/site-packages/README.txt \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/python3/ExternalProject_python3.mk b/external/python3/ExternalProject_python3.mk
index b03b09a83bc4..5350f9e4c5d9 100644
--- a/external/python3/ExternalProject_python3.mk
+++ b/external/python3/ExternalProject_python3.mk
@@ -36,6 +36,9 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
 		MAKEFLAGS= MSBuild.exe pcbuild.sln /t:Build \
 			/p:Configuration=$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) \
 			/p:Platform=$(if $(filter INTEL,$(CPUNAME)),Win32,x64) \
+			/p:opensslIncludeDir=$(call gb_UnpackedTarball_get_dir,openssl)/include \
+			/p:opensslOutDir=$(call gb_UnpackedTarball_get_dir,openssl)/out32dll \
+			/p:zlibDir=$(call gb_UnpackedTarball_get_dir,zlib) \
 			/maxcpucount \
 			$(if $(filter 150,$(VCVER)),/p:PlatformToolset=v141 /p:VisualStudioVersion=15.0 /ToolsVersion:15.0) \
 			$(if $(filter 160,$(VCVER)),/p:PlatformToolset=v142 /p:VisualStudioVersion=16.0 /ToolsVersion:Current) \
@@ -46,6 +49,12 @@ else
 
 # --with-system-expat: this should find the one in the workdir (or system)
 
+# OPENSSL_INCLUDES OPENSSL_LDFLAGS OPENSSL_LIBS cannot be set via commandline!
+# use --with-openssl instead, which requires include/ and lib/ subdirs.
+
+# TODO: libffi has different SONAME on CentOS 6 vs. 7, so we better use
+# --without-system-ffi. However, that doesn't actually do anything on Linux :(
+
 # create a symlink "LO_lib" because the .so are in a directory with platform
 # specific name like build/lib.linux-x86_64-3.3
 
@@ -77,17 +86,18 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
             ) \
 			--enable-framework=/@__________________________________________________OOO --with-framework-name=LibreOfficePython, \
 			--enable-shared \
+			$(if $(filter 1090 101000 101100 101200,$(MAC_OS_X_VERSION_MIN_REQUIRED)),ac_cv_func_utimensat=no) \
+		) \
+		$(if $(SYSTEM_OPENSSL)$(DISABLE_OPENSSL),,\
+			--with-openssl=$(call gb_UnpackedTarball_get_dir,openssl) \
 		) \
 		CC="$(strip $(CC) \
-			$(if $(SYSTEM_OPENSSL),,-I$(call gb_UnpackedTarball_get_dir,openssl)/include \
-				$(if $(DISABLE_OPENSSL),,-I$(call gb_UnpackedTarball_get_dir,openssl)/include)) \
 			$(if $(SYSTEM_EXPAT),,-I$(call gb_UnpackedTarball_get_dir,expat)/lib) \
 			$(if $(SYSBASE), -I$(SYSBASE)/usr/include) \
 			)" \
 		$(if $(python3_cflags),CFLAGS='$(python3_cflags)') \
 		$(if $(filter -fsanitize=%,$(CC)),LINKCC="$(CXX) -pthread") \
 		LDFLAGS="$(strip $(LDFLAGS) \
-			$(if $(SYSTEM_OPENSSL),,-L$(call gb_UnpackedTarball_get_dir,openssl)) \
 			$(if $(SYSTEM_EXPAT),,-L$(gb_StaticLibrary_WORKDIR)) \
 			$(if $(SYSTEM_ZLIB),,-L$(gb_StaticLibrary_WORKDIR)) \
 			$(if $(SYSBASE), -L$(SYSBASE)/usr/lib) \
diff --git a/external/python3/UnpackedTarball_python3.mk b/external/python3/UnpackedTarball_python3.mk
index 29d417e57833..d04868b93a44 100644
--- a/external/python3/UnpackedTarball_python3.mk
+++ b/external/python3/UnpackedTarball_python3.mk
@@ -17,16 +17,13 @@ $(eval $(call gb_UnpackedTarball_fix_end_of_line,python3,\
 
 $(eval $(call gb_UnpackedTarball_add_patches,python3,\
 	external/python3/i100492-freebsd.patch.1 \
-	$(if $(filter AIX,$(OS)),external/python3/python-3.3.3-aix.patch.1) \
 	external/python3/python-3.3.0-darwin.patch.1 \
-	external/python3/python-3.5.4-ssl.patch.1 \
+	external/python3/python-3.7.6-msvc-ssl.patch.1 \
 	external/python3/python-3.5.4-msvc-disable.patch.1 \
-	external/python3/python-3.3.0-pythreadstate.patch.1 \
 	external/python3/python-3.3.0-clang.patch.1 \
 	external/python3/ubsan.patch.0 \
 	external/python3/python-3.5.tweak.strip.soabi.patch \
 	external/python3/darwin.patch.0 \
-	external/python3/0001-3.6-bpo-17239-Disable-external-entities-in-SAX-parse.patch.1 \
 ))
 
 ifneq ($(filter DRAGONFLY FREEBSD LINUX NETBSD OPENBSD SOLARIS,$(OS)),)
@@ -47,12 +44,4 @@ $(eval $(call gb_UnpackedTarball_add_patches,python3, \
 ))
 endif
 
-ifeq ($(OS),MACOSX)
-ifneq ($(filter 1090 101000 101100 101200,$(MAC_OS_X_VERSION_MIN_REQUIRED)),)
-$(eval $(call gb_UnpackedTarball_add_patches,python3,\
-	external/python3/python3-osx-avoid-new-10.13.patch.1 \
-))
-endif
-endif
-
 # vim: set noet sw=4 ts=4:
diff --git a/external/python3/i100492-freebsd.patch.1 b/external/python3/i100492-freebsd.patch.1
index 9b4b33729f75..074e5fc489f8 100644
--- a/external/python3/i100492-freebsd.patch.1
+++ b/external/python3/i100492-freebsd.patch.1
@@ -1,39 +1,7 @@
 FreeBSD porting fixes, patch by maho at openoffice.org
 
---- python3.orig/Lib/test/test_threading.py	2015-07-05 18:50:07.000000000 +0200
-+++ python3/Lib/test/test_threading.py	2015-07-26 17:03:55.935367820 +0200
-@@ -24,8 +24,8 @@
- # #12316 and #11870), and fork() from a worker thread is known to trigger
- # problems with some operating systems (issue #3863): skip problematic tests
- # on platforms known to behave badly.
--platforms_to_skip = ('freebsd4', 'freebsd5', 'freebsd6', 'netbsd5',
--                     'hp-ux11')
-+platforms_to_skip = ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'netbsd5',
-+                     'os2emx', 'hp-ux11')
- 
- 
- # A trivial mutable counter.
 --- Python-3.3.0/Python/thread_pthread.h	2012-11-28 09:00:41.097955124 +0000
 +++ Python-3.3.0/Python/thread_pthread.h	2012-11-28 09:01:13.018329351 +0000
-@@ -42,6 +42,10 @@
- #endif
- #endif
- 
-+#ifdef __FreeBSD__
-+#include <osreldate.h>
-+#endif
-+
- /* The POSIX spec says that implementations supporting the sem_*
-    family of functions must indicate this by defining
-    _POSIX_SEMAPHORES. */
-@@ -60,7 +64,6 @@
-    in default setting.  So the process scope is preferred to get
-    enough number of threads to work. */
- #ifdef __FreeBSD__
--#include <osreldate.h>
- #if __FreeBSD_version >= 500000 && __FreeBSD_version < 504101
- #undef PTHREAD_SYSTEM_SCHED_SUPPORTED
- #endif
 @@ -186,6 +189,9 @@
  {
      pthread_t th;
@@ -44,11 +12,10 @@ FreeBSD porting fixes, patch by maho at openoffice.org
  #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
      pthread_attr_t attrs;
  #endif
-@@ -214,7 +220,10 @@
- #if defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
-     pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM);
- #endif
--
+@@ -214,6 +220,10 @@
+     callback->func = func;
+     callback->arg = arg;
+ 
 +#ifdef __FreeBSD__
 +	sigfillset(&set);
 +	SET_THREAD_SIGMASK(SIG_BLOCK, &set, &oset);
@@ -57,8 +24,8 @@ FreeBSD porting fixes, patch by maho at openoffice.org
  #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
                               &attrs,
 @@ -225,6 +234,9 @@
-                              (void *)arg
-                              );
+ #endif
+                              pythread_wrapper, callback);
  
 +#ifdef __FreeBSD__
 +	SET_THREAD_SIGMASK(SIG_SETMASK, &oset, NULL);
diff --git a/external/python3/python-3.3.0-pythreadstate.patch.1 b/external/python3/python-3.3.0-pythreadstate.patch.1
deleted file mode 100644
index 66350e2c8112..000000000000
--- a/external/python3/python-3.3.0-pythreadstate.patch.1
+++ /dev/null
@@ -1,15 +0,0 @@
-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.
diff --git a/external/python3/python-3.3.3-aix.patch.1 b/external/python3/python-3.3.3-aix.patch.1
deleted file mode 100644
index 571d69a88f6b..000000000000
--- a/external/python3/python-3.3.3-aix.patch.1
+++ /dev/null
@@ -1,146 +0,0 @@
-build with GCC on AIX
-
-diff -ru python3.orig/configure python3/configure
---- python3.orig/configure	2015-07-26 17:10:18.218393484 +0200
-+++ python3/configure	2015-07-26 17:29:44.460471779 +0200
-@@ -3534,8 +3534,6 @@
- else
- 
- 	case $ac_sys_system in
--	AIX*)   CC=${CC:-xlc_r}
--		without_gcc=;;
- 	*)	without_gcc=no;;
- 	esac
- fi
-@@ -5787,10 +5785,18 @@
- 	      PY3LIBRARY=libpython3.so
- 	  fi
-           ;;
--    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
-+    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|AIX*)
- 	  LDLIBRARY='libpython$(LDVERSION).so'
--	  BLDLIBRARY='-L. -lpython$(LDVERSION)'
--	  RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
-+	  case $ac_sys_system in
-+	    AIX*)
-+	      BLDLIBRARY='-Wl,-brtl -L. -lpython$(LDVERSION)'
-+	      RUNSHARED=LIBPATH=`pwd`:${LIBPATH}
-+	      ;;
-+	    *)
-+	      BLDLIBRARY='-L. -lpython$(LDVERSION)'
-+	      RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
-+	      ;;
-+	  esac
- 	  INSTSONAME="$LDLIBRARY".$SOVERSION
- 	  if test "$with_pydebug" != yes
-           then
-@@ -8789,8 +8795,13 @@
- then
- 	case $ac_sys_system/$ac_sys_release in
- 	AIX*)
--		BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:\$(srcdir)/Modules/python.exp"
--		LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
-+		if test "$GCC" = "yes"; then
-+		  LDSHARED='$(CC) -shared'
-+		  BLDSHARED='$(CC) -Wl,-brtl -shared'
-+		else
-+		  BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:\$(srcdir)/Modules/python.exp"
-+		  LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
-+		fi
- 		;;
- 	IRIX/5*) LDSHARED="ld -shared";;
- 	IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
-diff -ru python3.orig/configure.ac python3/configure.ac
---- python3.orig/configure.ac	2015-07-05 18:50:08.000000000 +0200
-+++ python3/configure.ac	2015-07-26 17:32:10.445481579 +0200
-@@ -587,8 +587,6 @@
- 		without_gcc=$withval;;
- 	esac], [
- 	case $ac_sys_system in
--	AIX*)   CC=${CC:-xlc_r}
--		without_gcc=;;
- 	*)	without_gcc=no;;
- 	esac])
- AC_MSG_RESULT($without_gcc)
-@@ -1090,10 +1088,18 @@
- 	      PY3LIBRARY=libpython3.so
- 	  fi
-           ;;
--    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
-+    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|AIX*)Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
- 	  LDLIBRARY='libpython$(LDVERSION).so'
--	  BLDLIBRARY='-L. -lpython$(LDVERSION)'
--	  RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
-+	  case $ac_sys_system in
-+	    AIX*)
-+	      BLDLIBRARY='-Wl,-brtl -L. -lpython$(LDVERSION)'
-+	      RUNSHARED=LIBPATH=`pwd`:${LIBPATH}
-+	      ;;
-+	    *)
-+	      BLDLIBRARY='-L. -lpython$(LDVERSION)'
-+	      RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
-+	      ;;
-+	  esac
- 	  INSTSONAME="$LDLIBRARY".$SOVERSION
- 	  if test "$with_pydebug" != yes
-           then
-@@ -2164,8 +2170,13 @@
- then
- 	case $ac_sys_system/$ac_sys_release in
- 	AIX*)
--		BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:\$(srcdir)/Modules/python.exp"
--		LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
-+		if test "$GCC" = "yes"; then
-+			LDSHARED='$(CC) -shared'
-+			BLDSHARED='$(CC) -Wl,-brtl -shared'
-+		else
-+			BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:\$(srcdir)/Modules/python.exp"
-+			LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
-+		fi
- 		;;
- 	IRIX/5*) LDSHARED="ld -shared";;
- 	IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
-diff -ru python3.orig/Makefile.pre.in python3/Makefile.pre.in
---- python3.orig/Makefile.pre.in	2015-07-05 18:50:07.000000000 +0200
-+++ python3/Makefile.pre.in	2015-07-26 17:34:00.386488960 +0200
-@@ -598,14 +598,17 @@
- 
- libpython$(LDVERSION).so: $(LIBRARY_OBJS)
- 	if test $(INSTSONAME) != $(LDLIBRARY); then \
--		$(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
-+		$(BLDSHARED) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
- 		$(LN) -f $(INSTSONAME) $@; \
- 	else \
- 		$(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
- 	fi
- 
- libpython3.so:	libpython$(LDVERSION).so
--	$(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^
-+	if [ "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" != "aix" ]; then \
-+		SONAME="-Wl,-h$@"; \
-+	fi; \
-+	$(BLDSHARED) $(NO_AS_NEEDED) -o $@ $(SONAME) $^
- 
- libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
- 	 $(CC) -dynamiclib -Wl,-single_module $(PY_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
-@@ -1299,6 +1305,8 @@
- 	export PATH; PATH="`pwd`:$$PATH"; \
- 	export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
- 	export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
-+	export LD_LIBRARY_PATH; LD_LIBRARY_PATH="`pwd`${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"; \
-+	export LIBPATH; LIBPATH="`pwd`${LIBPATH:+:$LIBPATH}"; \
- 	export EXE; EXE="$(BUILDEXE)"; \
- 	if [ -n "$(MULTIARCH)" ]; then export MULTIARCH; MULTIARCH=$(MULTIARCH); fi; \
- 	export PYTHON_FOR_BUILD; \
-diff -ru python3.orig/Modules/Setup.dist python3/Modules/Setup.dist
---- python3.orig/Modules/Setup.dist	2015-07-05 18:50:07.000000000 +0200
-+++ python3/Modules/Setup.dist	2015-07-26 17:34:27.951490811 +0200
-@@ -181,7 +181,7 @@
- #_bisect _bisectmodule.c	# Bisection algorithms
- #_heapq _heapqmodule.c	# Heap queue algorithm
- 
--#unicodedata unicodedata.c    # static Unicode character database
-+unicodedata unicodedata.c    # static Unicode character database
- 
- 
- # Modules with some UNIX dependencies -- on by default:
diff --git a/external/python3/python-3.3.3-disable-obmalloc.patch.0 b/external/python3/python-3.3.3-disable-obmalloc.patch.0
index a162298d4971..0963a5f1bb1d 100644
--- a/external/python3/python-3.3.3-disable-obmalloc.patch.0
+++ b/external/python3/python-3.3.3-disable-obmalloc.patch.0
@@ -1,14 +1,3 @@
---- Include/objimpl.h
-+++ Include/objimpl.h
-@@ -250,7 +250,7 @@
-         union _gc_head *gc_prev;
-         Py_ssize_t gc_refs;
-     } gc;
--    double dummy;  /* force worst-case alignment */
-+    long double dummy;  /* force worst-case alignment */
- } PyGC_Head;
- 
- extern PyGC_Head *_PyGC_generation0;
 --- Objects/obmalloc.c
 +++ Objects/obmalloc.c
 @@ -413,8 +413,8 @@
@@ -24,9 +13,9 @@
 @@ -1181,7 +1181,7 @@
  
  #ifdef WITH_VALGRIND
-     if (UNLIKELY(running_on_valgrind == -1))
+     if (UNLIKELY(running_on_valgrind == -1)) {
 -        running_on_valgrind = RUNNING_ON_VALGRIND;
 +        running_on_valgrind = 1;
-     if (UNLIKELY(running_on_valgrind))
-         goto redirect;
- #endif
+     }
+     if (UNLIKELY(running_on_valgrind)) {
+         return NULL;
diff --git a/external/python3/python-3.3.3-elf-rpath.patch.1 b/external/python3/python-3.3.3-elf-rpath.patch.1
index 029d98c0310d..0dfa16c8c247 100644
--- a/external/python3/python-3.3.3-elf-rpath.patch.1
+++ b/external/python3/python-3.3.3-elf-rpath.patch.1
@@ -9,11 +9,11 @@ diff -ru python3.orig/Makefile.pre.in python3/Makefile.pre.in
  
  # Build the interpreter
  $(BUILDPYTHON):	Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
--	$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
-+	$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) -Wl,-rpath,\$$ORIGIN
+-	$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
++	$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) -Wl,-rpath,\$$ORIGIN
  
  platform: $(BUILDPYTHON) pybuilddir.txt
- 	$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print(get_platform()+"-"+sys.version[0:3])' >platform
+ 	$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform
 --- python3.orig/Makefile.pre.in	2015-07-05 18:50:07.000000000 +0200
 +++ python3/Makefile.pre.in	2015-07-26 17:34:00.386488960 +0200
 @@ -607,7 +607,7 @@
@@ -24,5 +24,4 @@ diff -ru python3.orig/Makefile.pre.in python3/Makefile.pre.in
 +	$(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^ -Wl,-rpath,\$$ORIGIN
  
  libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
- 	 $(CC) -dynamiclib -Wl,-single_module $(PY_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
-
+ 	 $(CC) -dynamiclib -Wl,-single_module $(PY_CORE_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
diff --git a/external/python3/python-3.5.4-msvc-disable.patch.1 b/external/python3/python-3.5.4-msvc-disable.patch.1
index 54b2a5f46540..416ab2c7b15b 100644
--- a/external/python3/python-3.5.4-msvc-disable.patch.1
+++ b/external/python3/python-3.5.4-msvc-disable.patch.1
@@ -45,17 +45,12 @@ diff -ru python3.orig/PCbuild/pcbuild.sln python3/PCbuild/pcbuild.sln
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_multiprocessing", "_multiprocessing.vcxproj", "{9E48B300-37D1-11DD-8C41-005056C00008}"
  EndProject
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python3dll", "python3dll.vcxproj", "{885D4898-D08D-4091-9C40-C700CFE3FC5A}"
-@@ -80,12 +64,6 @@
+@@ -75,8 +75,6 @@
  EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testmultiphase", "_testmultiphase.vcxproj", "{16BFE6F0-22EF-40B5-B831-7E937119EF10}"
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_queue", "_queue.vcxproj", "{78D80A15-BD8C-44E2-B49E-1F05B0A0A687}"
  EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tcl", "tcl.vcxproj", "{B5FD6F1D-129E-4BFF-9340-03606FAC7283}"
+-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblzma", "liblzma.vcxproj", "{12728250-16EC-4DC6-94D7-E21DD88947F8}"
 -EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tix", "tix.vcxproj", "{C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}"
--EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tk", "tk.vcxproj", "{7E85ECCF-A72C-4DA4-9E52-884508E80BA1}"
--EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyshellext", "pyshellext.vcxproj", "{0F6EE4A4-C75F-4578-B4B3-2D64F4B9B782}"
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python_uwp", "python_uwp.vcxproj", "{9DE9E23D-C8D4-4817-92A9-920A8B1FE5FF}"
  EndProject
- Global
-Only in python3/PCbuild: pcbuild.sln~
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "venvlauncher", "venvlauncher.vcxproj", "{494BAC80-A60C-43A9-99E7-ACB691CE2C4D}"
diff --git a/external/python3/python-3.5.4-ssl.patch.1 b/external/python3/python-3.5.4-ssl.patch.1
deleted file mode 100644
index beb6fe38882f..000000000000
--- a/external/python3/python-3.5.4-ssl.patch.1
+++ /dev/null
@@ -1,83 +0,0 @@
--*- Mode: diff -*-
-
-Tweak SSL build to find OpenSSL in workdir & not build it itself in "ssl.vcproj" etc.
-
-diff -ru python3.orig/PCbuild/pcbuild.sln python3/PCbuild/pcbuild.sln
---- python3.orig/PCbuild/pcbuild.sln	2017-08-09 23:39:15.511897077 +0200
-+++ python3/PCbuild/pcbuild.sln	2017-08-09 23:48:41.375890717 +0200
-@@ -86,10 +86,6 @@
- EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tk", "tk.vcxproj", "{7E85ECCF-A72C-4DA4-9E52-884508E80BA1}"
- EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libeay", "libeay.vcxproj", "{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}"
--EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssleay", "ssleay.vcxproj", "{10615B24-73BF-4EFA-93AA-236916321317}"
--EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyshellext", "pyshellext.vcxproj", "{0F6EE4A4-C75F-4578-B4B3-2D64F4B9B782}"
- EndProject
- Global
-diff -ru python3.orig/PCbuild/_ssl.vcxproj python3/PCbuild/_ssl.vcxproj
---- python3.orig/PCbuild/_ssl.vcxproj	2017-08-07 09:59:11.000000000 +0200
-+++ python3/PCbuild/_ssl.vcxproj	2017-08-09 23:50:36.871889419 +0200
-@@ -1,4 +1,4 @@
--<?xml version="1.0" encoding="utf-8"?>
-+<?xml version="1.0" encoding="utf-8"?>
- <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-   <ItemGroup Label="ProjectConfigurations">
-     <ProjectConfiguration Include="Debug|Win32">
-@@ -61,10 +61,10 @@
-   </PropertyGroup>
-   <ItemDefinitionGroup>
-     <ClCompile>
--      <AdditionalIncludeDirectories>$(opensslIncludeDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-+      <AdditionalIncludeDirectories>$(WORKDIR)/UnpackedTarball/openssl/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-     </ClCompile>
-     <Link>
--      <AdditionalDependencies>ws2_32.lib;crypt32.lib;$(OutDir)libeay$(PyDebugExt).lib;$(OutDir)ssleay$(PyDebugExt).lib;%(AdditionalDependencies)</AdditionalDependencies>
-+      <AdditionalDependencies>ws2_32.lib;crypt32.lib;$(WORKDIR)\UnpackedTarball\openssl\out32dll\libeay32.lib;$(WORKDIR)\UnpackedTarball\openssl\out32dll\ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-     </Link>
-   </ItemDefinitionGroup>
-   <ItemGroup>
-@@ -78,14 +78,6 @@
-       <Project>{cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}</Project>
-       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
-     </ProjectReference>
--    <ProjectReference Include="libeay.vcxproj">
--      <Project>{e5b04cc0-eb4c-42ab-b4dc-18ef95f864b0}</Project>
--      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
--    </ProjectReference>
--    <ProjectReference Include="ssleay.vcxproj">
--      <Project>{10615b24-73bf-4efa-93aa-236916321317}</Project>
--      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
--    </ProjectReference>
-     <ProjectReference Include="_socket.vcxproj">
-       <Project>{86937f53-c189-40ef-8ce8-8759d8e7d480}</Project>
-       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
-diff -ru python3.orig/setup.py python3/setup.py
---- python3.orig/setup.py	2017-08-09 23:39:15.495897077 +0200
-+++ python3/setup.py	2017-08-09 23:53:06.891887733 +0200
-@@ -807,7 +807,10 @@
-         exts.append( Extension('_socket', ['socketmodule.c'],
-                                depends = ['socketmodule.h']) )
-         # Detect SSL support for the socket module (via _ssl)
-+        ooosslinc = os.environ.get('WORKDIR') + \
-+            '/UnpackedTarball/openssl/include/'
-         search_for_ssl_incs_in = [
-+                              ooosslinc,
-                               '/usr/local/ssl/include',
-                               '/usr/contrib/ssl/include/'
-                              ]
-@@ -819,8 +822,12 @@
-                                ['/usr/kerberos/include'])
-             if krb5_h:
-                 ssl_incs += krb5_h
-+        ooossllib = os.environ.get('WORKDIR') + \
-+            '/UnpackedTarball/openssl'
-+        ooosslinc = ooosslinc + '/'
-         ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
--                                     ['/usr/local/ssl/lib',
-+                                     [ooossllib,
-+                                      '/usr/local/ssl/lib',
-                                       '/usr/contrib/ssl/lib/'
-                                      ] )
- 
diff --git a/external/python3/python-3.7.6-msvc-ssl.patch.1 b/external/python3/python-3.7.6-msvc-ssl.patch.1
new file mode 100644
index 000000000000..14e7cca0a8ce
--- /dev/null
+++ b/external/python3/python-3.7.6-msvc-ssl.patch.1
@@ -0,0 +1,25 @@
+No use for applink.c OPENSSL_Applink, everything is compiled with the same MSVC
+
+--- python3/PCbuild/_ssl.vcxproj.orig2	2019-12-23 15:54:19.254298900 +0100
++++ python3/PCbuild/_ssl.vcxproj	2019-12-23 15:54:24.693251200 +0100
+@@ -67,9 +67,6 @@
+   </ItemDefinitionGroup>
+   <ItemGroup>
+     <ClCompile Include="..\Modules\_ssl.c" />
+-    <ClCompile Include="$(opensslIncludeDir)\applink.c">
+-      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;$(PreprocessorDefinitions)</PreprocessorDefinitions>
+-    </ClCompile>
+   </ItemGroup>
+   <ItemGroup>
+     <ResourceCompile Include="..\PC\python_nt.rc" />
+--- python3/PCbuild/openssl.props.orig	2019-12-23 16:20:34.588135900 +0100
++++ python3/PCbuild/openssl.props	2019-12-23 16:20:51.074001300 +0100
+@@ -6,7 +6,7 @@
+     </ClCompile>
+     <Link>
+       <AdditionalLibraryDirectories>$(opensslOutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+-      <AdditionalDependencies>ws2_32.lib;libcrypto.lib;libssl.lib;%(AdditionalDependencies)</AdditionalDependencies>
++      <AdditionalDependencies>ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+     </Link>
+   </ItemDefinitionGroup>
+   <PropertyGroup>
diff --git a/external/python3/python3-osx-avoid-new-10.13.patch.1 b/external/python3/python3-osx-avoid-new-10.13.patch.1
deleted file mode 100644
index 93bf5a078e01..000000000000
--- a/external/python3/python3-osx-avoid-new-10.13.patch.1
+++ /dev/null
@@ -1,61 +0,0 @@
--*- Mode: Diff -*-
-
---- python3/Modules/posixmodule.c
-+++ python3/Modules/posixmodule.c
-@@ -4565,12 +4565,12 @@
-     } \
- 
- 
--#if defined(HAVE_FUTIMESAT) || defined(HAVE_UTIMENSAT)
-+#if defined(HAVE_FUTIMESAT)
- 
- static int
- utime_dir_fd(utime_t *ut, int dir_fd, char *path, int follow_symlinks)
- {
--#ifdef HAVE_UTIMENSAT
-+#if 0
-     int flags = follow_symlinks ? 0 : AT_SYMLINK_NOFOLLOW;
-     UTIME_TO_TIMESPEC;
-     return utimensat(dir_fd, path, time, flags);
-@@ -4591,12 +4591,12 @@
-     #define FUTIMENSAT_DIR_FD_CONVERTER dir_fd_unavailable
- #endif
- 
--#if defined(HAVE_FUTIMES) || defined(HAVE_FUTIMENS)
-+#if defined(HAVE_FUTIMES)
- 
- static int
- utime_fd(utime_t *ut, int fd)
- {
--#ifdef HAVE_FUTIMENS
-+#if 0
-     UTIME_TO_TIMESPEC;
-     return futimens(fd, time);
- #else
-@@ -4619,7 +4619,7 @@
- static int
- utime_nofollow_symlinks(utime_t *ut, char *path)
- {
--#ifdef HAVE_UTIMENSAT
-+#if 0
-     UTIME_TO_TIMESPEC;
-     return utimensat(DEFAULT_DIR_FD, path, time, AT_SYMLINK_NOFOLLOW);
- #else
-@@ -4635,7 +4635,7 @@
- static int
- utime_default(utime_t *ut, char *path)
- {
--#ifdef HAVE_UTIMENSAT
-+#if 0
-     UTIME_TO_TIMESPEC;
-     return utimensat(DEFAULT_DIR_FD, path, time, 0);
- #elif defined(HAVE_UTIMES)
-@@ -4836,7 +4836,7 @@
-     else
- #endif
- 
--#if defined(HAVE_FUTIMESAT) || defined(HAVE_UTIMENSAT)
-+#if defined(HAVE_FUTIMESAT)
-     if ((dir_fd != DEFAULT_DIR_FD) || (!follow_symlinks))
-         result = utime_dir_fd(&utime, dir_fd, path->narrow, follow_symlinks);
-     else
diff --git a/external/python3/ubsan.patch.0 b/external/python3/ubsan.patch.0
index 36d2acf1c947..938acc1f1725 100644
--- a/external/python3/ubsan.patch.0
+++ b/external/python3/ubsan.patch.0
@@ -1,25 +1,3 @@
---- Modules/_ctypes/libffi/src/x86/ffi64.c
-+++ Modules/_ctypes/libffi/src/x86/ffi64.c
-@@ -548,11 +548,15 @@
-   tramp = (volatile unsigned short *) &closure->tramp[0];
- 
-   tramp[0] = 0xbb49;		/* mov <code>, %r11	*/
--  *((unsigned long long * volatile) &tramp[1])
--    = (unsigned long) ffi_closure_unix64;
-+  tramp[1] = (unsigned long) ffi_closure_unix64;
-+  tramp[2] = ((unsigned long) ffi_closure_unix64) >> 16;
-+  tramp[3] = ((unsigned long) ffi_closure_unix64) >> 32;
-+  tramp[4] = ((unsigned long) ffi_closure_unix64) >> 48;
-   tramp[5] = 0xba49;		/* mov <data>, %r10	*/
--  *((unsigned long long * volatile) &tramp[6])
--    = (unsigned long) codeloc;
-+  tramp[6] = (unsigned long) codeloc;
-+  tramp[7] = ((unsigned long) codeloc) >> 16;
-+  tramp[8] = ((unsigned long) codeloc) >> 32;
-+  tramp[9] = ((unsigned long) codeloc) >> 48;
- 
-   /* Set the carry bit iff the function uses any sse registers.
-      This is clc or stc, together with the first byte of the jmp.  */
 --- Modules/_ctypes/libffi_osx/x86/x86-ffi64.c
 +++ Modules/_ctypes/libffi_osx/x86/x86-ffi64.c
 @@ -599,9 +599,15 @@
diff --git a/pyuno/inc/pyuno.hxx b/pyuno/inc/pyuno.hxx
index 39f5a0ed128f..faad68d8320a 100644
--- a/pyuno/inc/pyuno.hxx
+++ b/pyuno/inc/pyuno.hxx
@@ -277,6 +277,7 @@ public:
 class LO_DLLPUBLIC_PYUNO PyThreadAttach
 {
     PyThreadState *tstate;
+    bool m_isNewState;
     PyThreadAttach ( const PyThreadAttach & ) = delete;
     PyThreadAttach & operator = ( const PyThreadAttach & ) = delete;
 public:
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index d554f5ca769c..a6a875addc46 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -336,13 +336,14 @@ static int lcl_PySlice_GetIndicesEx( PyObject *pObject, sal_Int32 nLen, sal_Int3
 {
     Py_ssize_t nStart_ssize, nStop_ssize, nStep_ssize, nSliceLength_ssize;
 
-    int nResult = PySlice_GetIndicesEx(
+    int nResult =
 #if PY_VERSION_HEX >= 0x030200f0
-        pObject,
+        PySlice_GetIndicesEx(pObject,
+        nLen, &nStart_ssize, &nStop_ssize, &nStep_ssize, &nSliceLength_ssize );
 #else
-        reinterpret_cast<PySliceObject*>(pObject),
-#endif
+        PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(pObject),
         nLen, &nStart_ssize, &nStop_ssize, &nStep_ssize, &nSliceLength_ssize );
+#endif
     if (nResult == -1)
         return -1;
 
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index 62b3861288c3..5fa923c236dc 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -974,8 +974,21 @@ Any Runtime::extractUnoException( const PyRef & excType, const PyRef &excValue,
 
 
 PyThreadAttach::PyThreadAttach( PyInterpreterState *interp)
+    : m_isNewState(false)
 {
-    tstate = PyThreadState_New( interp );
+    // note: *may* be called recursively, with PyThreadDetach between  - in
+    // that case, don't create *new* PyThreadState but reuse!
+#ifndef NDEBUG
+    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
+    tstate = PyGILState_GetThisThreadState(); // from TLS, possibly detached
+    if (!tstate)
+    {
+        m_isNewState = true;
+        tstate = PyThreadState_New( interp );
+    }
     if( !tstate  )
         throw RuntimeException( "Couldn't create a pythreadstate" );
     PyEval_AcquireThread( tstate);
@@ -983,9 +996,19 @@ PyThreadAttach::PyThreadAttach( PyInterpreterState *interp)
 
 PyThreadAttach::~PyThreadAttach()
 {
-    PyThreadState_Clear( tstate );
-    PyEval_ReleaseThread( tstate );
-    PyThreadState_Delete( tstate );
+    if (m_isNewState)
+    {   // Clear needs GIL!
+        PyThreadState_Clear( tstate );
+    }
+    if (m_isNewState)
+    {   // note: PyThreadState_Delete(tstate) cannot be called, it will assert
+        // because it requires a PyThreadState to be set, but not the tstate!
+        PyThreadState_DeleteCurrent();
+    }
+    else
+    {
+        PyEval_ReleaseThread( tstate );
+    }
 }
 
 PyThreadDetach::PyThreadDetach()


More information about the Libreoffice-commits mailing list