RepositoryExternal.mk                                             |    7 
 configure.ac                                                      |   10 
 download.lst                                                      |    8 
 external/libffi/ExternalPackage_libffi.mk                         |   20 
 external/libffi/ExternalProject_libffi.mk                         |   29 
 external/libffi/Module_libffi.mk                                  |    1 
 external/openssl/ExternalPackage_openssl.mk                       |   12 
 external/openssl/ExternalProject_openssl.mk                       |   15 
 external/openssl/UnpackedTarball_openssl.mk                       |   12 
 external/openssl/ccb0a11145ee72b042d10593a64eaf9e8a55ec12.patch.1 |   56 
 external/openssl/openssl-1.0.1h-win64.patch.1                     |   47 
 external/openssl/openssl-1.0.2k-cve-2020-1971.patch.1             |  578 
----------
 external/openssl/openssl-3650-masm.patch.1                        |   35 
 external/openssl/openssl-fixbuild.patch.1                         |   23 
 external/openssl/openssl-no-multilib.patch.0                      |   38 
 external/openssl/openssllnx.patch                                 |   23 
 external/openssl/opensslsol.patch                                 |   20 
 external/openssl/opensslwnt.patch                                 |  167 --
 external/openssl/opensslwnt_safeseh.patch                         |   23 
 external/postgresql/ExternalProject_postgresql.mk                 |    2 
 external/postgresql/postgres-msvc-build.patch.1                   |    6 
 external/python3/ExternalPackage_python3.mk                       |  278 ++--
 external/python3/ExternalProject_python3.mk                       |   28 
 external/python3/UnpackedTarball_python3.mk                       |    1 
 external/python3/i100492-freebsd.patch.1                          |    6 
 external/python3/internal-zlib.patch.0                            |   22 
 external/python3/python-3.3.0-clang.patch.1                       |   13 
 external/python3/python-3.3.0-darwin.patch.1                      |   20 
 external/python3/python-3.3.3-disable-obmalloc.patch.0            |    4 
 external/python3/python-3.3.3-elf-rpath.patch.1                   |   12 
 external/python3/python-3.5.4-msvc-disable.patch.1                |    8 
 external/python3/python-3.5.tweak.strip.soabi.patch               |    2 
 external/python3/python-3.7.6-msvc-ssl.patch.1                    |   27 
 external/python3/ubsan.patch.0                                    |   23 
 librelogo/source/LibreLogo/LibreLogo.py                           |   34 
 pyuno/source/loader/pythonloader.py                               |    4 
 scripting/source/pyprov/pythonscript.py                           |    8 
 37 files changed, 359 insertions(+), 1263 deletions(-)

New commits:
commit 35942d66034d92cacd264fceca7f83860b9509c1
Author:     Michael Stahl <[email protected]>
AuthorDate: Fri Dec 9 11:51:22 2022 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:44 2022 +0100

    python3: upgrade to release 3.8.16
    
    Fixes CVE-2022-37454 and a few other ones that look less relevant
    including CVE-2022-45061 and CVE-2015-20107.
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143849
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit 05f55b3898407828bb24347be56247f58803f7bb)
    
    Change-Id: I10fd254f7f0801d47119234bb3436874e98d8c91

diff --git a/configure.ac b/configure.ac
index 05a0417b6fde..7547cc781a0b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8797,7 +8797,7 @@ internal)
     SYSTEM_PYTHON=
     PYTHON_VERSION_MAJOR=3
     PYTHON_VERSION_MINOR=8
-    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.15
+    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.16
     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 a3806d7de09a..8c83963fcb78 100644
--- a/download.lst
+++ b/download.lst
@@ -212,8 +212,8 @@ export POPPLER_SHA256SUM := 
d7a8f748211359cadb774ba3e18ecda6464b34027045c0648eb3
 export POPPLER_TARBALL := poppler-22.09.0.tar.xz
 export POSTGRESQL_SHA256SUM := 
9b81067a55edbaabc418aacef457dd8477642827499560b00615a6ea6c13f6b3
 export POSTGRESQL_TARBALL := postgresql-13.5.tar.bz2
-export PYTHON_SHA256SUM := 
5114fc7918a2a5e20eb5aac696b30c36f412c6ef24b13f5c9eb9e056982d9550
-export PYTHON_TARBALL := Python-3.8.15.tar.xz
+export PYTHON_SHA256SUM := 
d85dbb3774132473d8081dcb158f34a10ccad7a90b96c7e50ea4bb61f5ce4562
+export PYTHON_TARBALL := Python-3.8.16.tar.xz
 export QRCODEGEN_SHA256SUM := 
fcdf9fd69fde07ae4dca2351d84271a9de8093002f733b77c70f52f1630f6e4a
 export QRCODEGEN_TARBALL := QR-Code-generator-1.4.0.tar.gz
 export QXP_SHA256SUM := 
e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
commit 5a2b888249ac6e43f8304c10496791c64dc2318b
Author:     Taichi Haradaguchi <[email protected]>
AuthorDate: Mon Oct 24 00:52:04 2022 +0900
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:43 2022 +0100

    Python3: update to 3.8.15
    
    * Fixes CVE-2022-40674
    * Removed 0001-3.6-bpo-17239-Disable-external-entities-in-SAX-parse.patch.1 
as fixed upstream
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141691
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>
    (cherry picked from commit ea5843b67f1c2006aa1f68f2d00a991e1d463262)
    
    Change-Id: I8e71f9a6b013ca4c45bf8774b284be98eee71bab

diff --git a/configure.ac b/configure.ac
index 932dc6693d3d..05a0417b6fde 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8797,7 +8797,7 @@ internal)
     SYSTEM_PYTHON=
     PYTHON_VERSION_MAJOR=3
     PYTHON_VERSION_MINOR=8
-    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.13
+    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.15
     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 2f6c4ce3821b..a3806d7de09a 100644
--- a/download.lst
+++ b/download.lst
@@ -212,8 +212,8 @@ export POPPLER_SHA256SUM := 
d7a8f748211359cadb774ba3e18ecda6464b34027045c0648eb3
 export POPPLER_TARBALL := poppler-22.09.0.tar.xz
 export POSTGRESQL_SHA256SUM := 
9b81067a55edbaabc418aacef457dd8477642827499560b00615a6ea6c13f6b3
 export POSTGRESQL_TARBALL := postgresql-13.5.tar.bz2
-export PYTHON_SHA256SUM := 
6f309077012040aa39fe8f0c61db8c0fa1c45136763299d375c9e5756f09cf57
-export PYTHON_TARBALL := Python-3.8.13.tar.xz
+export PYTHON_SHA256SUM := 
5114fc7918a2a5e20eb5aac696b30c36f412c6ef24b13f5c9eb9e056982d9550
+export PYTHON_TARBALL := Python-3.8.15.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/python3/i100492-freebsd.patch.1 
b/external/python3/i100492-freebsd.patch.1
index 074e5fc489f8..b2ca1ee7117f 100644
--- a/external/python3/i100492-freebsd.patch.1
+++ b/external/python3/i100492-freebsd.patch.1
@@ -2,7 +2,7 @@ FreeBSD porting fixes, patch by [email protected]
 
 --- 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
-@@ -186,6 +189,9 @@
+@@ -238,6 +238,9 @@
  {
      pthread_t th;
      int status;
@@ -12,7 +12,7 @@ FreeBSD porting fixes, patch by [email protected]
  #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
      pthread_attr_t attrs;
  #endif
-@@ -214,6 +220,10 @@
+@@ -277,6 +280,10 @@
      callback->func = func;
      callback->arg = arg;
  
@@ -23,7 +23,7 @@ FreeBSD porting fixes, patch by [email protected]
      status = pthread_create(&th,
  #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
                               &attrs,
-@@ -225,6 +234,9 @@
+@@ -285,6 +292,9 @@
  #endif
                               pythread_wrapper, callback);
  
diff --git a/external/python3/internal-zlib.patch.0 
b/external/python3/internal-zlib.patch.0
index de68d9e7dec8..27bb737db0c7 100644
--- a/external/python3/internal-zlib.patch.0
+++ b/external/python3/internal-zlib.patch.0
@@ -19,7 +19,7 @@
  
 --- setup.py
 +++ setup.py
-@@ -1362,7 +1362,7 @@
+@@ -1483,7 +1483,7 @@
          #
          # You can upgrade zlib to version 1.1.4 yourself by going to
          # http://www.gzip.org/zlib/
@@ -28,7 +28,7 @@
          have_zlib = False
          if zlib_inc is not None:
              zlib_h = zlib_inc[0] + '/zlib.h'
-@@ -1379,13 +1379,13 @@
+@@ -1500,13 +1500,13 @@
                          version = line.split()[2]
                          break
              if version >= version_req:
@@ -44,7 +44,7 @@
                                         extra_link_args=zlib_extra_link_args))
                      have_zlib = True
                  else:
-@@ -1399,7 +1399,7 @@
+@@ -1520,7 +1520,7 @@
          # crc32 if we have it.  Otherwise binascii uses its own.
          if have_zlib:
              extra_compile_args = ['-DUSE_ZLIB_CRC32']
diff --git a/external/python3/python-3.3.0-darwin.patch.1 
b/external/python3/python-3.3.0-darwin.patch.1
index 27a355e2ad21..39d3c9180a19 100644
--- a/external/python3/python-3.3.0-darwin.patch.1
+++ b/external/python3/python-3.3.0-darwin.patch.1
@@ -5,7 +5,7 @@ LO needs to build both against MacOSX SDK and not produce 
universal binaries.
 diff -ru python3.orig/configure python3/configure
 --- python3.orig/configure     2015-07-26 17:36:11.808497783 +0200
 +++ python3/configure  2015-07-26 17:38:49.016508337 +0200
-@@ -6794,7 +6794,20 @@
+@@ -7385,7 +7385,20 @@
          then
              case "$UNIVERSAL_ARCHS" in
              32-bit)
@@ -30,7 +30,7 @@ diff -ru python3.orig/configure python3/configure
 diff -ru python3.orig/Mac/Makefile.in python3/Mac/Makefile.in
 --- python3.orig/Mac/Makefile.in       2015-07-05 18:50:07.000000000 +0200
 +++ python3/Mac/Makefile.in    2015-07-26 17:40:14.860514100 +0200
-@@ -43,7 +43,7 @@
+@@ -44,7 +44,7 @@
  INSTALL_SCRIPT= @INSTALL_SCRIPT@
  INSTALL_DATA=@INSTALL_DATA@
  LN=@LN@
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 0963a5f1bb1d..c4a1dea61ecf 100644
--- a/external/python3/python-3.3.3-disable-obmalloc.patch.0
+++ b/external/python3/python-3.3.3-disable-obmalloc.patch.0
@@ -1,6 +1,6 @@
 --- Objects/obmalloc.c
 +++ Objects/obmalloc.c
-@@ -413,8 +413,8 @@
+@@ -712,8 +712,8 @@
  
  #ifdef WITH_PYMALLOC
  
@@ -10,7 +10,7 @@
  
  /* If we're using GCC, use __builtin_expect() to reduce overhead of
     the valgrind checks */
-@@ -1181,7 +1181,7 @@
+@@ -1430,7 +1430,7 @@
  
  #ifdef WITH_VALGRIND
      if (UNLIKELY(running_on_valgrind == -1)) {
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 55546afd9844..a408858f5917 100644
--- a/external/python3/python-3.3.3-elf-rpath.patch.1
+++ b/external/python3/python-3.3.3-elf-rpath.patch.1
@@ -5,7 +5,7 @@ set RPATH (only to be used on ELF platforms)
 diff -ru python3.orig/Makefile.pre.in python3/Makefile.pre.in
 --- python3.orig/Makefile.pre.in       2015-07-26 20:29:07.126194320 +0200
 +++ python3/Makefile.pre.in    2015-07-26 20:37:21.814227530 +0200
-@@ -563,7 +563,7 @@
+@@ -566,7 +566,7 @@
  
  # Build the interpreter
  $(BUILDPYTHON):       Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
@@ -14,7 +14,7 @@ diff -ru python3.orig/Makefile.pre.in python3/Makefile.pre.in
  
  platform: $(BUILDPYTHON) pybuilddir.txt
        $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import 
get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' 
>platform
-@@ -625,7 +625,7 @@
+@@ -628,7 +628,7 @@
        fi
  
  libpython3.so:        libpython$(LDVERSION).so
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 52c007d7d5b6..d5b4e3f6264b 100644
--- a/external/python3/python-3.5.4-msvc-disable.patch.1
+++ b/external/python3/python-3.5.4-msvc-disable.patch.1
@@ -3,7 +3,7 @@ Disable some stuff LO does not need, especially stuff with 
external dependencies
 diff -ru python3.orig/PCbuild/pcbuild.sln python3/PCbuild/pcbuild.sln
 --- python3.orig/PCbuild/pcbuild.sln   2017-08-10 00:04:44.359879894 +0200
 +++ python3/PCbuild/pcbuild.sln        2017-08-10 00:13:51.179873748 +0200
-@@ -12,8 +12,6 @@
+@@ -15,8 +15,6 @@
  EndProject
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", 
"pythoncore.vcxproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}"
  EndProject
@@ -12,7 +12,7 @@ diff -ru python3.orig/PCbuild/pcbuild.sln 
python3/PCbuild/pcbuild.sln
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winsound", 
"winsound.vcxproj", "{28B5D777-DDF2-4B6B-B34F-31D938813856}"
  EndProject
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_decimal", 
"_decimal.vcxproj", "{0E9791DB-593A-465F-98BC-681011311617}"
-@@ -28,34 +26,20 @@
+@@ -31,34 +29,20 @@
  EndProject
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_socket", 
"_socket.vcxproj", "{86937F53-C189-40EF-8CE8-8759D8E7D480}"
  EndProject
@@ -47,7 +47,7 @@ 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}"
-@@ -75,8 +75,6 @@
+@@ -93,8 +77,6 @@
  EndProject
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_queue", 
"_queue.vcxproj", "{78D80A15-BD8C-44E2-B49E-1F05B0A0A687}"
  EndProject
diff --git a/external/python3/python-3.5.tweak.strip.soabi.patch 
b/external/python3/python-3.5.tweak.strip.soabi.patch
index 48ac7f82f8be..4c2bb2bb9a29 100644
--- a/external/python3/python-3.5.tweak.strip.soabi.patch
+++ b/external/python3/python-3.5.tweak.strip.soabi.patch
@@ -1,7 +1,7 @@
 diff -ru python3.orig/configure python3/configure
 --- misc/python3.orig/configure        2015-07-26 21:14:31.127377193 +0200
 +++ misc/python3/configure     2015-07-26 21:21:34.975405648 +0200
-@@ -14388,7 +14388,7 @@
+@@ -15229,7 +15229,7 @@
  $as_echo "$ABIFLAGS" >&6; }
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking SOABI" >&5
  $as_echo_n "checking SOABI... " >&6; }
diff --git a/external/python3/python-3.7.6-msvc-ssl.patch.1 
b/external/python3/python-3.7.6-msvc-ssl.patch.1
index 7c4a6ebc0fb7..17cc440f2204 100644
--- a/external/python3/python-3.7.6-msvc-ssl.patch.1
+++ b/external/python3/python-3.7.6-msvc-ssl.patch.1
@@ -2,7 +2,7 @@ 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 @@
+@@ -99,9 +99,6 @@
    </ItemDefinitionGroup>
    <ItemGroup>
      <ClCompile Include="..\Modules\_ssl.c" />
diff --git a/external/python3/ubsan.patch.0 b/external/python3/ubsan.patch.0
index 9f458b1e0f95..d44fbe055c86 100644
--- a/external/python3/ubsan.patch.0
+++ b/external/python3/ubsan.patch.0
@@ -20,7 +20,7 @@
                This is clc or stc, together with the first byte of the jmp.  */
 --- Modules/posixmodule.c
 +++ Modules/posixmodule.c
-@@ -23,6 +23,9 @@
+@@ -13998,6 +13998,9 @@
  };
  
  static int
@@ -32,7 +32,7 @@
  #ifdef F_OK
 --- Objects/listobject.c
 +++ Objects/listobject.c
-@@ -548,7 +548,7 @@
+@@ -554,7 +554,7 @@
          dest[i] = v;
      }
      src = b->ob_item;
commit 7e3132f7435392ea11fcf6818b46221ab582a11a
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Tue Dec 1 14:44:01 2020 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:43 2022 +0100

    external/python3: Silence UBSan errors with --with-pydebug
    
    ...that happen when building ExternalProject_python3 itself after
    12142490cd43f8568ab29e0ddfa75b334d6d39d5 "Enable Python Py_DEBUG setting 
when
    built with --enable-dbgutil on Linux":
    
    For one, silence
    
    > Modules/posixmodule.c:14395:9: runtime error: left shift of 34 by 26 
places cannot be represented in type 'int'
    >  #0 in all_ins at 
workdir/UnpackedTarball/python3/./Modules/posixmodule.c:14395:9
    
    where at least my kernel-headers-5.9.9-200.fc33.x86_64
    /usr/include/linux/memfd.h has
    
    > #define MFD_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB
    
    and /usr/include/asm-generic/hugetlb_encode.h has
    
    > #define HUGETLB_FLAG_ENCODE_16GB      (34 << HUGETLB_FLAG_ENCODE_SHIFT)
    
    For another (and as predicted in 29d47d22c43e6adc1850b7db5880028dcd07d1b3 
"Fix
    passing --disable-optimized into external/python3": "in a Linux UBsan build,
    making ExternalProject_python3 would have started to cause some 'applying 
zero
    offset to null pointer' failures, but which would have been easy to fix"),
    silence
    
    > Objects/listobject.c:551:24: runtime error: applying zero offset to null 
pointer
    >  #0 in list_concat at 
workdir/UnpackedTarball/python3/Objects/listobject.c:551:24
    
    Change-Id: I0523cd35e393000c8e67629a0522b2db1d8c16f0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106984
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>
    (cherry picked from commit 1657639d5e405c6e1e988d51a1f267c378c74b53)

diff --git a/external/python3/ubsan.patch.0 b/external/python3/ubsan.patch.0
index 938acc1f1725..9f458b1e0f95 100644
--- a/external/python3/ubsan.patch.0
+++ b/external/python3/ubsan.patch.0
@@ -18,3 +18,26 @@
  
        /*      Set the carry bit if the function uses any sse registers.
                This is clc or stc, together with the first byte of the jmp.  */
+--- Modules/posixmodule.c
++++ Modules/posixmodule.c
+@@ -23,6 +23,9 @@
+ };
+ 
+ static int
++#if defined __clang__
++__attribute__((no_sanitize("shift-base"))) // MFD_HUGE_16GB in 
/usr/include/linux/memfd.h
++#endif
+ all_ins(PyObject *m)
+ {
+ #ifdef F_OK
+--- Objects/listobject.c
++++ Objects/listobject.c
+@@ -548,7 +548,7 @@
+         dest[i] = v;
+     }
+     src = b->ob_item;
+-    dest = np->ob_item + Py_SIZE(a);
++    dest = Py_SIZE(a) == 0 ? np->ob_item : np->ob_item + Py_SIZE(a);
+     for (i = 0; i < Py_SIZE(b); i++) {
+         PyObject *v = src[i];
+         Py_INCREF(v);
commit c2e00faf84f94a8eb9fdd3404b124801b90a990a
Author:     Taichi Haradaguchi <[email protected]>
AuthorDate: Tue Sep 6 21:10:53 2022 +0900
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:43 2022 +0100

    python3: upgrade to release 3.8.13
    
    Remove some code in external/python3/darwin.patch.0 as it was fixed 
upstream(https://bugs.python.org/issue45405).
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139493
    Tested-by: Jenkins
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>
    (cherry picked from commit c8fd50f9ec02a131fd4c99e80f7252b49015653a)
    
    Change-Id: Ie6bfb2456f96a63adbf0dbcb9c902dc56f1151ee

diff --git a/configure.ac b/configure.ac
index 681dc96d0888..932dc6693d3d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8797,7 +8797,7 @@ internal)
     SYSTEM_PYTHON=
     PYTHON_VERSION_MAJOR=3
     PYTHON_VERSION_MINOR=8
-    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.10
+    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.13
     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 49e351414a48..2f6c4ce3821b 100644
--- a/download.lst
+++ b/download.lst
@@ -212,8 +212,8 @@ export POPPLER_SHA256SUM := 
d7a8f748211359cadb774ba3e18ecda6464b34027045c0648eb3
 export POPPLER_TARBALL := poppler-22.09.0.tar.xz
 export POSTGRESQL_SHA256SUM := 
9b81067a55edbaabc418aacef457dd8477642827499560b00615a6ea6c13f6b3
 export POSTGRESQL_TARBALL := postgresql-13.5.tar.bz2
-export PYTHON_SHA256SUM := 
6af24a66093dd840bcccf371d4044a3027e655cf24591ce26e48022bc79219d9
-export PYTHON_TARBALL := Python-3.8.10.tar.xz
+export PYTHON_SHA256SUM := 
6f309077012040aa39fe8f0c61db8c0fa1c45136763299d375c9e5756f09cf57
+export PYTHON_TARBALL := Python-3.8.13.tar.xz
 export QRCODEGEN_SHA256SUM := 
fcdf9fd69fde07ae4dca2351d84271a9de8093002f733b77c70f52f1630f6e4a
 export QRCODEGEN_TARBALL := QR-Code-generator-1.4.0.tar.gz
 export QXP_SHA256SUM := 
e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
commit a65a5484b9946e0c41eb7622db5aabf951682560
Author:     Jan-Marek Glogowski <[email protected]>
AuthorDate: Thu Jun 24 08:26:33 2021 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:43 2022 +0100

    python3: update to 3.8.10
    
    So we don't build 3.8.8rc1 anymore. I didn't look into 3.9.
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117757
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <[email protected]>
    (cherry picked from commit c22fc8e1f60bb98a87d22e7ff9bd3290dbb9fe02)
    
    Change-Id: Ife7d898c913b9b164168b0ef23a055deea55815f

diff --git a/configure.ac b/configure.ac
index 76095dfb0a94..681dc96d0888 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8797,7 +8797,7 @@ internal)
     SYSTEM_PYTHON=
     PYTHON_VERSION_MAJOR=3
     PYTHON_VERSION_MINOR=8
-    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.8
+    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.10
     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 e572ad71b136..49e351414a48 100644
--- a/download.lst
+++ b/download.lst
@@ -212,8 +212,8 @@ export POPPLER_SHA256SUM := 
d7a8f748211359cadb774ba3e18ecda6464b34027045c0648eb3
 export POPPLER_TARBALL := poppler-22.09.0.tar.xz
 export POSTGRESQL_SHA256SUM := 
9b81067a55edbaabc418aacef457dd8477642827499560b00615a6ea6c13f6b3
 export POSTGRESQL_TARBALL := postgresql-13.5.tar.bz2
-export PYTHON_SHA256SUM := 
bd746ed1ad9ccfa9b2a8d13736a5c452025c3600913d000078e6ed1df3d767b6
-export PYTHON_TARBALL := Python-3.8.8rc1.tar.xz
+export PYTHON_SHA256SUM := 
6af24a66093dd840bcccf371d4044a3027e655cf24591ce26e48022bc79219d9
+export PYTHON_TARBALL := Python-3.8.10.tar.xz
 export QRCODEGEN_SHA256SUM := 
fcdf9fd69fde07ae4dca2351d84271a9de8093002f733b77c70f52f1630f6e4a
 export QRCODEGEN_TARBALL := QR-Code-generator-1.4.0.tar.gz
 export QXP_SHA256SUM := 
e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
commit 09ffd69fe845aea4165d6bc9b7925a947128a3d0
Author:     Michael Stahl <[email protected]>
AuthorDate: Fri Feb 19 11:53:27 2021 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:43 2022 +0100

    python3: upgrade to release 3.8.8rc1
    
    Fixes CVE-2021-3177 plus these less important ones:
    CVE-2021-23336 CVE-2020-27619 CVE-2020-26116 CVE-2019-20907
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111208
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit a0c8dc42335764d07c16a017c6b00486ec17ae53)
    
    Change-Id: Idbe072a9db1faf8363b4f7795b9fde71c26969f0

diff --git a/configure.ac b/configure.ac
index 6b20ba01d1f8..76095dfb0a94 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8797,7 +8797,7 @@ internal)
     SYSTEM_PYTHON=
     PYTHON_VERSION_MAJOR=3
     PYTHON_VERSION_MINOR=8
-    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.4
+    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.8
     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 72ed476d5dc1..e572ad71b136 100644
--- a/download.lst
+++ b/download.lst
@@ -212,8 +212,8 @@ export POPPLER_SHA256SUM := 
d7a8f748211359cadb774ba3e18ecda6464b34027045c0648eb3
 export POPPLER_TARBALL := poppler-22.09.0.tar.xz
 export POSTGRESQL_SHA256SUM := 
9b81067a55edbaabc418aacef457dd8477642827499560b00615a6ea6c13f6b3
 export POSTGRESQL_TARBALL := postgresql-13.5.tar.bz2
-export PYTHON_SHA256SUM := 
5f41968a95afe9bc12192d7e6861aab31e80a46c46fa59d3d837def6a4cd4d37
-export PYTHON_TARBALL := Python-3.8.4.tar.xz
+export PYTHON_SHA256SUM := 
bd746ed1ad9ccfa9b2a8d13736a5c452025c3600913d000078e6ed1df3d767b6
+export PYTHON_TARBALL := Python-3.8.8rc1.tar.xz
 export QRCODEGEN_SHA256SUM := 
fcdf9fd69fde07ae4dca2351d84271a9de8093002f733b77c70f52f1630f6e4a
 export QRCODEGEN_TARBALL := QR-Code-generator-1.4.0.tar.gz
 export QXP_SHA256SUM := 
e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
commit 16af3ca89495d2f20e5daf3e050258c74dd47018
Author:     Jan-Marek Glogowski <[email protected]>
AuthorDate: Tue Jul 14 23:35:57 2020 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:42 2022 +0100

    python3: update to 3.8.4
    
    With all the prerequisites in place, LO can be updated to the
    current Python release. Interestingly I found that Cygwin always
    seems to use LC_COLLATE=C, probably because the default collation
    rules are missing.
    
    Then there are the changes introduced in "PEP 587 -- Python
    Initialization Configuration", which appearingly have modified the
    DLL search path behaviour on Windows, so the OpenSLL DLLs aren't
    found anymore in the program directory. As a workaround, the
    OpenSLL and libffi DLLs are now (also) installed into the Python
    lib dir on Windows.
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98437
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <[email protected]>
    (cherry picked from commit b4dfba947768834ffecc09056992019878711c8b)
    
    Change-Id: Ib82f7b77213da9c525f8c79a13d128d9eec9ca64

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 2afe604ba26f..dda5b6c84bf9 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -3179,7 +3179,7 @@ $(call gb_LinkTarget_add_libs,$(1),\
 else
 $(call gb_LinkTarget_add_libs,$(1),\
        -L$(call gb_UnpackedTarball_get_dir,python3) \
-       -lpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m \
+       -lpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
 )
 endif
 
diff --git a/configure.ac b/configure.ac
index cafb223193ee..6b20ba01d1f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8796,8 +8796,8 @@ int main(int argc, char **argv) {
 internal)
     SYSTEM_PYTHON=
     PYTHON_VERSION_MAJOR=3
-    PYTHON_VERSION_MINOR=7
-    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.10
+    PYTHON_VERSION_MINOR=8
+    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.4
     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 fd2cbcdc163e..72ed476d5dc1 100644
--- a/download.lst
+++ b/download.lst
@@ -212,8 +212,8 @@ export POPPLER_SHA256SUM := 
d7a8f748211359cadb774ba3e18ecda6464b34027045c0648eb3
 export POPPLER_TARBALL := poppler-22.09.0.tar.xz
 export POSTGRESQL_SHA256SUM := 
9b81067a55edbaabc418aacef457dd8477642827499560b00615a6ea6c13f6b3
 export POSTGRESQL_TARBALL := postgresql-13.5.tar.bz2
-export PYTHON_SHA256SUM := 
f8d82e7572c86ec9d55c8627aae5040124fd2203af400c383c821b980306ee6b
-export PYTHON_TARBALL := Python-3.7.10.tar.xz
+export PYTHON_SHA256SUM := 
5f41968a95afe9bc12192d7e6861aab31e80a46c46fa59d3d837def6a4cd4d37
+export PYTHON_TARBALL := Python-3.8.4.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/libffi/ExternalPackage_libffi.mk 
b/external/libffi/ExternalPackage_libffi.mk
index 212e63aa36af..61b0a1ca460c 100644
--- a/external/libffi/ExternalPackage_libffi.mk
+++ b/external/libffi/ExternalPackage_libffi.mk
@@ -12,7 +12,7 @@ $(eval $(call 
gb_ExternalPackage_ExternalPackage,libffi,libffi))
 $(eval $(call gb_ExternalPackage_use_external_project,libffi,libffi))
 
 ifeq ($(COM),MSC)
-$(eval $(call gb_ExternalPackage_add_files,libffi,$(LIBO_LIB_FOLDER),\
+$(eval $(call 
gb_ExternalPackage_add_files,libffi,$(LIBO_LIB_FOLDER)/python-core-$(PYTHON_VERSION)/lib,
 \
     $(HOST_PLATFORM)/.libs/libffi-7.dll \
 ))
 endif
diff --git a/external/openssl/ExternalPackage_openssl.mk 
b/external/openssl/ExternalPackage_openssl.mk
index de77f53f33b9..d0c0dbaab975 100644
--- a/external/openssl/ExternalPackage_openssl.mk
+++ b/external/openssl/ExternalPackage_openssl.mk
@@ -16,6 +16,14 @@ $(eval $(call 
gb_ExternalPackage_add_files,openssl,$(LIBO_LIB_FOLDER),\
     libcrypto-1_1.dll \
     libssl-1_1.dll \
 ))
+ifneq ($(DISABLE_PYTHON),TRUE)
+ifneq ($(SYSTEM_PYTHON),TRUE)
+$(eval $(call 
gb_ExternalPackage_add_files,openssl,$(LIBO_LIB_FOLDER)/python-core-$(PYTHON_VERSION)/lib,
 \
+    libcrypto-1_1.dll \
+    libssl-1_1.dll \
+))
+endif
+endif
 endif
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/python3/ExternalPackage_python3.mk 
b/external/python3/ExternalPackage_python3.mk
index 4dfc3b196f82..f7b8d67f25b2 100644
--- a/external/python3/ExternalPackage_python3.mk
+++ b/external/python3/ExternalPackage_python3.mk
@@ -25,17 +25,14 @@ endif
 $(eval $(call 
gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib,\
        PCbuild/$(python_arch_subdir)_asyncio$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
        PCbuild/$(python_arch_subdir)_ctypes$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
-       PCbuild/$(python_arch_subdir)_ctypes_test$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
        PCbuild/$(python_arch_subdir)_decimal$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
        PCbuild/$(python_arch_subdir)_elementtree$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
        PCbuild/$(python_arch_subdir)_msi$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd 
\
        PCbuild/$(python_arch_subdir)_multiprocessing$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+       PCbuild/$(python_arch_subdir)_overlapped$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
        PCbuild/$(python_arch_subdir)_queue$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
        PCbuild/$(python_arch_subdir)_socket$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
        PCbuild/$(python_arch_subdir)_ssl$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd 
\
-       PCbuild/$(python_arch_subdir)_testbuffer$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
-       PCbuild/$(python_arch_subdir)_testcapi$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
-       PCbuild/$(python_arch_subdir)_testconsole$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
        PCbuild/$(python_arch_subdir)pyexpat$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
        PCbuild/$(python_arch_subdir)select$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
        PCbuild/$(python_arch_subdir)unicodedata$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
@@ -44,8 +41,8 @@ $(eval $(call 
gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-cor
 else
 $(eval $(call 
gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/python.bin,python))
 $(eval $(call 
gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/libpython$(PYTHON_VERSION_MAJOR).so,libpython$(PYTHON_VERSION_MAJOR).so))
-$(eval $(call 
gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so.1.0,libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so))
-$(eval $(call 
gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so.1.0-gdb.py,Tools/gdb/libpython.py))
+$(eval $(call 
gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so.1.0,libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so))
+$(eval $(call 
gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/python-gdb.py,Tools/gdb/libpython.py))
 
 # Unfortunately the python build system does not allow to explicitly enable or
 # disable these, it just tries to build them and then prints which did not
@@ -56,70 +53,68 @@ $(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 \
-       
LO_lib/_codecs_iso2022.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so
 \
-       
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 \
-       
LO_lib/_ctypes_test.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so 
\
-       
LO_lib/_datetime.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
-       
LO_lib/_decimal.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
-       
LO_lib/_elementtree.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so 
\
-       
LO_lib/fcntl.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
-       LO_lib/grp.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
+       LO_lib/array.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so 
\
+       
LO_lib/_asyncio.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/audioop.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/binascii.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_bisect.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_blake2.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       LO_lib/cmath.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so 
\
+       
LO_lib/_codecs_cn.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_codecs_hk.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_codecs_iso2022.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so
 \
+       
LO_lib/_codecs_jp.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_codecs_kr.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_codecs_tw.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_contextvars.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_crypt.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       LO_lib/_csv.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_ctypes.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_datetime.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_decimal.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_elementtree.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       LO_lib/fcntl.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so 
\
+       LO_lib/grp.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
        $(if $(DISABLE_OPENSSL),, \
-               
LO_lib/_hashlib.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
+               
LO_lib/_hashlib.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
        ) \
-       
LO_lib/_heapq.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
-       
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
 \
-       
LO_lib/_opcode.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
-       
LO_lib/ossaudiodev.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
-       
LO_lib/parser.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
-       
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 
\
+       
LO_lib/_heapq.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       LO_lib/_json.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so 
\
+       
LO_lib/_lsprof.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       LO_lib/math.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       LO_lib/_md5.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       LO_lib/mmap.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_multibytecodec.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so
 \
+       
LO_lib/_multiprocessing.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so
 \
+       
LO_lib/_opcode.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/ossaudiodev.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/parser.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_pickle.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_posixshmem.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_posixsubprocess.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so
 \
+       
LO_lib/pyexpat.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_queue.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_random.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/resource.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/select.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       LO_lib/_sha1.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so 
\
+       
LO_lib/_sha256.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       LO_lib/_sha3.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so 
\
+       
LO_lib/_sha512.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_socket.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       LO_lib/spwd.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
        $(if $(DISABLE_OPENSSL),, \
-               
LO_lib/_ssl.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
+               
LO_lib/_ssl.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
        ) \
-       
LO_lib/_struct.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
-       
LO_lib/syslog.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
-       
LO_lib/termios.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
-       
LO_lib/_testbuffer.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
-       
LO_lib/_testcapi.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
-       
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/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 
\
+       
LO_lib/_statistics.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_struct.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/syslog.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/termios.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/unicodedata.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/xxlimited.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       
LO_lib/_xxsubinterpreters.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so
 \
+       
LO_lib/_xxtestfuzz.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
+       LO_lib/zlib.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR).so \
 ))
 endif
 endif
@@ -140,7 +135,7 @@ endif
 # 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_m_$(python3_MACHDEP)_$(subst i686,i386,$(subst 
-pc,,$(HOST_PLATFORM))).py \
+       LO_lib/_sysconfigdata__$(python3_MACHDEP)_$(subst i686,i386,$(subst 
-pc,,$(HOST_PLATFORM))).py \
 ))
 endif
 
@@ -150,6 +145,10 @@ endif
 # idlelib, tkinter, turtledemo - need Tk to build the C module
 # test - probably unnecessary? was explicitly removed #i116738#
 # venv - why would we need virtual environments
+#
+# These lists are now sorted with "LC_COLLATE=C sort", by using
+#   find Lib/ -name "*.py" | sort | sed -e 's/^/\t/' -e 's/$/ \\/'
+#
 
 $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib,\
        LICENSE \
@@ -162,6 +161,7 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/_dummy_thread.py \
        Lib/_markupbase.py \
        Lib/_osx_support.py \
+       Lib/_py_abc.py \
        Lib/_pydecimal.py \
        Lib/_pyio.py \
        Lib/_sitebuiltins.py \
@@ -180,6 +180,7 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/binhex.py \
        Lib/bisect.py \
        Lib/bz2.py \
+       Lib/cProfile.py \
        Lib/calendar.py \
        Lib/cgi.py \
        Lib/cgitb.py \
@@ -195,7 +196,6 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/contextvars.py \
        Lib/copy.py \
        Lib/copyreg.py \
-       Lib/cProfile.py \
        Lib/crypt.py \
        Lib/csv.py \
        Lib/dataclasses.py \
@@ -232,7 +232,6 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/linecache.py \
        Lib/locale.py \
        Lib/lzma.py \
-       Lib/macpath.py \
        Lib/mailbox.py \
        Lib/mailcap.py \
        Lib/mimetypes.py \
@@ -260,21 +259,20 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/profile.py \
        Lib/pstats.py \
        Lib/pty.py \
-       Lib/pyclbr.py \
-       Lib/_py_abc.py \
        Lib/py_compile.py \
+       Lib/pyclbr.py \
        Lib/pydoc.py \
        Lib/queue.py \
        Lib/quopri.py \
        Lib/random.py \
-       Lib/reprlib.py \
        Lib/re.py \
+       Lib/reprlib.py \
        Lib/rlcompleter.py \
        Lib/runpy.py \
        Lib/sched.py \
        Lib/secrets.py \
-       Lib/shelve.py \
        Lib/selectors.py \
+       Lib/shelve.py \
        Lib/shlex.py \
        Lib/shutil.py \
        Lib/signal.py \
@@ -288,10 +286,10 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/sre_constants.py \
        Lib/sre_parse.py \
        Lib/ssl.py \
-       Lib/statistics.py \
        Lib/stat.py \
-       Lib/stringprep.py \
+       Lib/statistics.py \
        Lib/string.py \
+       Lib/stringprep.py \
        Lib/struct.py \
        Lib/subprocess.py \
        Lib/sunau.py \
@@ -306,10 +304,11 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/this.py \
        Lib/threading.py \
        Lib/timeit.py \
-       Lib/tokenize.py \
        Lib/token.py \
-       Lib/traceback.py \
+       Lib/tokenize.py \
        Lib/trace.py \
+       Lib/traceback.py \
+       Lib/tracemalloc.py \
        Lib/tty.py \
        Lib/turtle.py \
        Lib/types.py \
@@ -321,14 +320,41 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/weakref.py \
        Lib/webbrowser.py \
        Lib/xdrlib.py \
+       Lib/zipapp.py \
        Lib/zipfile.py \
+       Lib/zipimport.py \
 ))
 
 $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/asyncio,\
+       Lib/asyncio/__init__.py \
+       Lib/asyncio/__main__.py \
+       Lib/asyncio/base_events.py \
        Lib/asyncio/base_futures.py \
+       Lib/asyncio/base_subprocess.py \
        Lib/asyncio/base_tasks.py \
+       Lib/asyncio/constants.py \
+       Lib/asyncio/coroutines.py \
+       Lib/asyncio/events.py \
+       Lib/asyncio/exceptions.py \
        Lib/asyncio/format_helpers.py \
+       Lib/asyncio/futures.py \
+       Lib/asyncio/locks.py \
+       Lib/asyncio/log.py \
+       Lib/asyncio/proactor_events.py \
+       Lib/asyncio/protocols.py \
+       Lib/asyncio/queues.py \
        Lib/asyncio/runners.py \
+       Lib/asyncio/selector_events.py \
+       Lib/asyncio/sslproto.py \
+       Lib/asyncio/staggered.py \
+       Lib/asyncio/streams.py \
+       Lib/asyncio/subprocess.py \
+       Lib/asyncio/tasks.py \
+       Lib/asyncio/transports.py \
+       Lib/asyncio/trsock.py \
+       Lib/asyncio/unix_events.py \
+       Lib/asyncio/windows_events.py \
+       Lib/asyncio/windows_utils.py \
 ))
 
 $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/collections,\
@@ -383,8 +409,8 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/distutils/errors.py \
        Lib/distutils/extension.py \
        Lib/distutils/fancy_getopt.py \
-       Lib/distutils/filelist.py \
        Lib/distutils/file_util.py \
+       Lib/distutils/filelist.py \
        Lib/distutils/log.py \
        Lib/distutils/msvc9compiler.py \
        Lib/distutils/msvccompiler.py \
@@ -393,44 +419,44 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/distutils/text_file.py \
        Lib/distutils/unixccompiler.py \
        Lib/distutils/util.py \
-       Lib/distutils/versionpredicate.py \
        Lib/distutils/version.py \
+       Lib/distutils/versionpredicate.py \
 ))
 
 $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/distutils/command,\
        Lib/distutils/command/__init__.py \
+       Lib/distutils/command/bdist.py \
        Lib/distutils/command/bdist_dumb.py \
        Lib/distutils/command/bdist_msi.py \
-       Lib/distutils/command/bdist.py \
        Lib/distutils/command/bdist_rpm.py \
        Lib/distutils/command/bdist_wininst.py \
+       Lib/distutils/command/build.py \
        Lib/distutils/command/build_clib.py \
        Lib/distutils/command/build_ext.py \
-       Lib/distutils/command/build.py \
        Lib/distutils/command/build_py.py \
        Lib/distutils/command/build_scripts.py \
        Lib/distutils/command/check.py \
        Lib/distutils/command/clean.py \
        Lib/distutils/command/command_template \
        Lib/distutils/command/config.py \
+       Lib/distutils/command/install.py \
        Lib/distutils/command/install_data.py \
        Lib/distutils/command/install_egg_info.py \
        Lib/distutils/command/install_headers.py \
        Lib/distutils/command/install_lib.py \
-       Lib/distutils/command/install.py \
        Lib/distutils/command/install_scripts.py \
        Lib/distutils/command/register.py \
        Lib/distutils/command/sdist.py \
        Lib/distutils/command/upload.py \
-       Lib/distutils/command/wininst-10.0-amd64.exe \
        Lib/distutils/command/wininst-10.0.exe \
-       Lib/distutils/command/wininst-14.0-amd64.exe \
+       Lib/distutils/command/wininst-10.0-amd64.exe \
        Lib/distutils/command/wininst-14.0.exe \
+       Lib/distutils/command/wininst-14.0-amd64.exe \
        Lib/distutils/command/wininst-6.0.exe \
        Lib/distutils/command/wininst-7.1.exe \
        Lib/distutils/command/wininst-8.0.exe \
-       Lib/distutils/command/wininst-9.0-amd64.exe \
        Lib/distutils/command/wininst-9.0.exe \
+       Lib/distutils/command/wininst-9.0-amd64.exe \
 ))
 
 $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/email,\
@@ -474,8 +500,8 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/encodings/aliases.py \
        Lib/encodings/ascii.py \
        Lib/encodings/base64_codec.py \
-       Lib/encodings/big5hkscs.py \
        Lib/encodings/big5.py \
+       Lib/encodings/big5hkscs.py \
        Lib/encodings/bz2_codec.py \
        Lib/encodings/charmap.py \
        Lib/encodings/cp037.py \
@@ -492,10 +518,10 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/encodings/cp1256.py \
        Lib/encodings/cp1257.py \
        Lib/encodings/cp1258.py \
+       Lib/encodings/cp273.py \
        Lib/encodings/cp424.py \
        Lib/encodings/cp437.py \
        Lib/encodings/cp500.py \
-       Lib/encodings/cp65001.py \
        Lib/encodings/cp720.py \
        Lib/encodings/cp737.py \
        Lib/encodings/cp775.py \
@@ -529,20 +555,20 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/encodings/hp_roman8.py \
        Lib/encodings/hz.py \
        Lib/encodings/idna.py \
+       Lib/encodings/iso2022_jp.py \
        Lib/encodings/iso2022_jp_1.py \
-       Lib/encodings/iso2022_jp_2004.py \
        Lib/encodings/iso2022_jp_2.py \
+       Lib/encodings/iso2022_jp_2004.py \
        Lib/encodings/iso2022_jp_3.py \
        Lib/encodings/iso2022_jp_ext.py \
-       Lib/encodings/iso2022_jp.py \
        Lib/encodings/iso2022_kr.py \
+       Lib/encodings/iso8859_1.py \
        Lib/encodings/iso8859_10.py \
        Lib/encodings/iso8859_11.py \
        Lib/encodings/iso8859_13.py \
        Lib/encodings/iso8859_14.py \
        Lib/encodings/iso8859_15.py \
        Lib/encodings/iso8859_16.py \
-       Lib/encodings/iso8859_1.py \
        Lib/encodings/iso8859_2.py \
        Lib/encodings/iso8859_3.py \
        Lib/encodings/iso8859_4.py \
@@ -565,8 +591,8 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/encodings/mac_greek.py \
        Lib/encodings/mac_iceland.py \
        Lib/encodings/mac_latin2.py \
-       Lib/encodings/mac_romanian.py \
        Lib/encodings/mac_roman.py \
+       Lib/encodings/mac_romanian.py \
        Lib/encodings/mac_turkish.py \
        Lib/encodings/mbcs.py \
        Lib/encodings/oem.py \
@@ -576,19 +602,18 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/encodings/quopri_codec.py \
        Lib/encodings/raw_unicode_escape.py \
        Lib/encodings/rot_13.py \
-       Lib/encodings/shift_jis_2004.py \
        Lib/encodings/shift_jis.py \
+       Lib/encodings/shift_jis_2004.py \
        Lib/encodings/shift_jisx0213.py \
        Lib/encodings/tis_620.py \
        Lib/encodings/undefined.py \
        Lib/encodings/unicode_escape.py \
-       Lib/encodings/unicode_internal.py \
+       Lib/encodings/utf_16.py \
        Lib/encodings/utf_16_be.py \
        Lib/encodings/utf_16_le.py \
-       Lib/encodings/utf_16.py \
+       Lib/encodings/utf_32.py \
        Lib/encodings/utf_32_be.py \
        Lib/encodings/utf_32_le.py \
-       Lib/encodings/utf_32.py \
        Lib/encodings/utf_7.py \
        Lib/encodings/utf_8.py \
        Lib/encodings/utf_8_sig.py \
@@ -616,6 +641,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/metadata.py \
        Lib/importlib/resources.py \
        Lib/importlib/util.py \
 ))
@@ -652,8 +678,8 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/lib2to3/fixes/fix_buffer.py \
        Lib/lib2to3/fixes/fix_dict.py \
        Lib/lib2to3/fixes/fix_except.py \
-       Lib/lib2to3/fixes/fix_execfile.py \
        Lib/lib2to3/fixes/fix_exec.py \
+       Lib/lib2to3/fixes/fix_execfile.py \
        Lib/lib2to3/fixes/fix_exitfunc.py \
        Lib/lib2to3/fixes/fix_filter.py \
        Lib/lib2to3/fixes/fix_funcattrs.py \
@@ -662,13 +688,13 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/lib2to3/fixes/fix_has_key.py \
        Lib/lib2to3/fixes/fix_idioms.py \
        Lib/lib2to3/fixes/fix_import.py \
-       Lib/lib2to3/fixes/fix_imports2.py \
        Lib/lib2to3/fixes/fix_imports.py \
+       Lib/lib2to3/fixes/fix_imports2.py \
        Lib/lib2to3/fixes/fix_input.py \
        Lib/lib2to3/fixes/fix_intern.py \
        Lib/lib2to3/fixes/fix_isinstance.py \
-       Lib/lib2to3/fixes/fix_itertools_imports.py \
        Lib/lib2to3/fixes/fix_itertools.py \
+       Lib/lib2to3/fixes/fix_itertools_imports.py \
        Lib/lib2to3/fixes/fix_long.py \
        Lib/lib2to3/fixes/fix_map.py \
        Lib/lib2to3/fixes/fix_metaclass.py \
@@ -708,8 +734,8 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/lib2to3/pgen2/literals.py \
        Lib/lib2to3/pgen2/parse.py \
        Lib/lib2to3/pgen2/pgen.py \
-       Lib/lib2to3/pgen2/tokenize.py \
        Lib/lib2to3/pgen2/token.py \
+       Lib/lib2to3/pgen2/tokenize.py \
 ))
 
 $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/logging,\
@@ -718,13 +744,25 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/logging/handlers.py \
 ))
 
+ifeq (WNT,$(OS))
+$(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/msilib,\
+       Lib/msilib/__init__.py \
+       Lib/msilib/schema.py \
+       Lib/msilib/sequence.py \
+       Lib/msilib/text.py \
+))
+endif
+
 $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/multiprocessing,\
        Lib/multiprocessing/__init__.py \
        Lib/multiprocessing/connection.py \
        Lib/multiprocessing/context.py \
+       Lib/multiprocessing/dummy/__init__.py \
+       Lib/multiprocessing/dummy/connection.py \
        Lib/multiprocessing/forkserver.py \
        Lib/multiprocessing/heap.py \
        Lib/multiprocessing/managers.py \
+       Lib/multiprocessing/pool.py \
        Lib/multiprocessing/popen_fork.py \
        Lib/multiprocessing/popen_forkserver.py \
        Lib/multiprocessing/popen_spawn_posix.py \
@@ -733,7 +771,8 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/multiprocessing/queues.py \
        Lib/multiprocessing/reduction.py \
        Lib/multiprocessing/resource_sharer.py \
-       Lib/multiprocessing/semaphore_tracker.py \
+       Lib/multiprocessing/resource_tracker.py \
+       Lib/multiprocessing/shared_memory.py \
        Lib/multiprocessing/sharedctypes.py \
        Lib/multiprocessing/spawn.py \
        Lib/multiprocessing/synchronize.py \
@@ -754,6 +793,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/unittest,\
        Lib/unittest/__init__.py \
        Lib/unittest/__main__.py \
+       Lib/unittest/async_case.py \
        Lib/unittest/case.py \
        Lib/unittest/loader.py \
        Lib/unittest/main.py \
@@ -765,40 +805,6 @@ $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
        Lib/unittest/util.py \
 ))
 
-$(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/unittest/test,\
-       Lib/unittest/test/__init__.py \
-       Lib/unittest/test/__main__.py \
-       Lib/unittest/test/_test_warnings.py \
-       Lib/unittest/test/dummy.py \
-       Lib/unittest/test/support.py \
-       Lib/unittest/test/test_assertions.py \
-       Lib/unittest/test/test_break.py \
-       Lib/unittest/test/test_case.py \
-       Lib/unittest/test/test_discovery.py \
-       Lib/unittest/test/test_functiontestcase.py \
-       Lib/unittest/test/test_loader.py \
-       Lib/unittest/test/test_program.py \
-       Lib/unittest/test/test_result.py \
-       Lib/unittest/test/test_runner.py \
-       Lib/unittest/test/test_setups.py \
-       Lib/unittest/test/test_skipping.py \
-       Lib/unittest/test/test_suite.py \
-))
-
-$(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/unittest/test/testmock,\
-       Lib/unittest/test/testmock/__init__.py \
-       Lib/unittest/test/testmock/__main__.py \
-       Lib/unittest/test/testmock/support.py \
-       Lib/unittest/test/testmock/testcallable.py \
-       Lib/unittest/test/testmock/testhelpers.py \
-       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 \
-))
-
 $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/urllib,\
        Lib/urllib/__init__.py \
        Lib/urllib/error.py \
@@ -823,21 +829,21 @@ $(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/xml/dom,\
        Lib/xml/dom/__init__.py \
-       Lib/xml/dom/NodeFilter.py \
        Lib/xml/dom/domreg.py \
        Lib/xml/dom/expatbuilder.py \
        Lib/xml/dom/minicompat.py \
        Lib/xml/dom/minidom.py \
+       Lib/xml/dom/NodeFilter.py \
        Lib/xml/dom/pulldom.py \
        Lib/xml/dom/xmlbuilder.py \
 ))
 
 $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/xml/etree,\
        Lib/xml/etree/__init__.py \
+       Lib/xml/etree/cElementTree.py \
        Lib/xml/etree/ElementInclude.py \
        Lib/xml/etree/ElementPath.py \
        Lib/xml/etree/ElementTree.py \
-       Lib/xml/etree/cElementTree.py \
 ))
 
 $(eval $(call 
gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/xml/parsers,\
diff --git a/external/python3/ExternalProject_python3.mk 
b/external/python3/ExternalProject_python3.mk
index c47f8d84c2a8..1ff06a2382ed 100644
--- a/external/python3/ExternalProject_python3.mk
+++ b/external/python3/ExternalProject_python3.mk
@@ -30,16 +30,24 @@ ifeq ($(OS),WNT)
 
 # TODO: using Debug configuration and related mangling of pyconfig.h
 
+python3_WIN_PLATFORM_MSBUILD := $(strip \
+       $(if $(filter INTEL,$(CPUNAME)),Win32) \
+       $(if $(filter X86_64,$(CPUNAME)),x64) \
+       $(if $(filter ARM64,$(CPUNAME)),arm64) \
+       )
+
 # at least for MSVC 2008 it is necessary to clear MAKEFLAGS because
 # nmake is invoked
 $(call gb_ExternalProject_get_state_target,python3,build) :
        $(call gb_ExternalProject_run,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:Platform=$(python3_WIN_PLATFORM_MSBUILD) \
                        /p:opensslIncludeDir=$(call 
gb_UnpackedTarball_get_dir,openssl)/include \
                        /p:opensslOutDir=$(call 
gb_UnpackedTarball_get_dir,openssl) \
                        /p:zlibDir=$(call gb_UnpackedTarball_get_dir,zlib) \
+                       /p:libffiOutDir=$(call 
gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM)/.libs \
+                       /p:libffiIncludeDir=$(call 
gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM)/include \
                        /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) \
@@ -128,14 +136,14 @@ python3_fw_prefix=$(call 
gb_UnpackedTarball_get_dir,python3)/python-inst/@______
 $(call gb_ExternalProject_get_state_target,python3,fixscripts) : $(call 
gb_ExternalProject_get_state_target,python3,build)
        $(call gb_Output_announce,python3 - remove reference to installroot 
from scripts,build,CUS,5)
        $(COMMAND_ECHO)for file in \
-                       
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/2to3
 \
                        
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/2to3-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)
 \
+                       
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/easy_install-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)
 \
                        
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/idle$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)
 \
+                       
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/pip$(PYTHON_VERSION_MAJOR)
 \
+                       
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/pip$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)
 \
                        
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/pydoc$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)
 \
                        
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)-config
 \
-                       
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m-config
 \
-                       
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/pyvenv-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)
 ; do \
-       { rm "$$file" && $(gb_AWK) '\
+       ; do { rm "$$file" && $(gb_AWK) '\
                BEGIN {print "#!/bin/bash\n\
 origpath=$$(pwd)\n\
 bindir=$$(cd $$(dirname \"$$0\") ; pwd)\n\
@@ -157,16 +165,14 @@ $(call 
gb_ExternalProject_get_state_target,python3,fixinstallnames) : $(call gb_
                @loader_path/../../../LibreOfficePython $$file ; done
        touch $@
 
-# also delete binaries that are symlinked in scp2
 $(call gb_ExternalProject_get_state_target,python3,executables) : $(call 
gb_ExternalProject_get_state_target,python3,build)
        cd 
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin
 ; \
-       for file in python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
-                   python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m ; do 
\
        $(INSTALL_NAME_TOOL) -change \
                
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/LibreOfficePython
 \
-               @executable_path/../LibreOfficePython $$file ; done
+               @executable_path/../LibreOfficePython 
python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)
        touch $@
 
+# also delete binaries that are symlinked in scp2
 $(call gb_ExternalProject_get_state_target,python3,removeunnecessarystuff) : 
$(call gb_ExternalProject_get_state_target,python3,build)
        $(call gb_Output_announce,python3 - remove the stuff we don't need to 
ship,build,CUS,5)
        rm -rf 
$(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/test
diff --git a/external/python3/UnpackedTarball_python3.mk 
b/external/python3/UnpackedTarball_python3.mk
index c216f370fb61..8bf3b519f142 100644
--- a/external/python3/UnpackedTarball_python3.mk
+++ b/external/python3/UnpackedTarball_python3.mk
@@ -21,7 +21,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,python3,\
        external/python3/python-3.8-msvc-sdk.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-clang.patch.1 \
        external/python3/ubsan.patch.0 \
        external/python3/python-3.5.tweak.strip.soabi.patch \
        external/python3/darwin.patch.0 \
diff --git a/external/python3/internal-zlib.patch.0 
b/external/python3/internal-zlib.patch.0
index abe2630bd2e7..de68d9e7dec8 100644
--- a/external/python3/internal-zlib.patch.0
+++ b/external/python3/internal-zlib.patch.0
@@ -23,7 +23,7 @@
          #
          # You can upgrade zlib to version 1.1.4 yourself by going to
          # http://www.gzip.org/zlib/
--        zlib_inc = find_file('zlib.h', [], inc_dirs)
+-        zlib_inc = find_file('zlib.h', [], self.inc_dirs)
 +        zlib_inc = [os.environ.get('ZLIB_INCDIR')]
          have_zlib = False
          if zlib_inc is not None:
@@ -32,16 +32,16 @@
                          version = line.split()[2]
                          break
              if version >= version_req:
--                if (self.compiler.find_library_file(lib_dirs, 'z')):
-+                if (self.compiler.find_library_file(lib_dirs, 'zlib')):
-                     if host_platform == "darwin":
+-                if (self.compiler.find_library_file(self.lib_dirs, 'z')):
++                if (self.compiler.find_library_file(self.lib_dirs, 'zlib')):
+                     if MACOS:
                          zlib_extra_link_args = ('-Wl,-search_paths_first',)
                      else:
                          zlib_extra_link_args = ()
-                     exts.append( Extension('zlib', ['zlibmodule.c'],
--                                           libraries = ['z'],
-+                                           libraries = ['zlib'],
-                                            extra_link_args = 
zlib_extra_link_args))
+                     self.add(Extension('zlib', ['zlibmodule.c'],
+-                                       libraries=['z'],
++                                       libraries=['zlib'],
+                                        extra_link_args=zlib_extra_link_args))
                      have_zlib = True
                  else:
 @@ -1399,7 +1399,7 @@
diff --git a/external/python3/python-3.3.0-clang.patch.1 
b/external/python3/python-3.3.0-clang.patch.1
deleted file mode 100644
index 9001110fbed4..000000000000
--- a/external/python3/python-3.3.0-clang.patch.1
+++ /dev/null
@@ -1,13 +0,0 @@
--*- Mode: diff -*-
-
---- python3/setup.py
-+++ python3/setup.py
-@@ -436,7 +436,7 @@
-             if ret >> 8 == 0:
-                 with open(tmpfile) as fp:
-                     for line in fp.readlines():
--                        if line.startswith("gcc version"):
-+                        if line.startswith("gcc version") or 
line.startswith("clang -cc1 version"):
-                             is_gcc = True
-                         elif line.startswith("#include <...>"):
-                             in_incdirs = True
diff --git a/external/python3/python-3.3.0-darwin.patch.1 
b/external/python3/python-3.3.0-darwin.patch.1
index 10a696aa6e93..27a355e2ad21 100644
--- a/external/python3/python-3.3.0-darwin.patch.1
+++ b/external/python3/python-3.3.0-darwin.patch.1
@@ -63,19 +63,3 @@ diff -ru python3.orig/Mac/Resources/framework/Info.plist.in 
python3/Mac/Resource
        <key>CFBundleGetInfoString</key>
        <string>Python Runtime and Library</string>
        <key>CFBundleIdentifier</key>
-diff -ru python3.orig/setup.py python3/setup.py
---- python3.orig/setup.py      2015-07-26 17:36:11.804497783 +0200
-+++ python3/setup.py   2015-07-26 17:39:48.599512337 +0200
-@@ -468,11 +468,11 @@
-         # Ensure that /usr/local is always used, but the local build
-         # directories (i.e. '.' and 'Include') must be first.  See issue
-         # 10520.
--        if not cross_compiling:
-+        if not cross_compiling and host_platform != 'darwin':
-             add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
-             add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
-         # only change this for cross builds for 3.3, issues on Mageia
--        if cross_compiling:
-+        if cross_compiling or host_platform == 'darwin':
-             self.add_gcc_paths()
-         self.add_multiarch_paths()
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 0dfa16c8c247..55546afd9844 100644
--- a/external/python3/python-3.3.3-elf-rpath.patch.1
+++ b/external/python3/python-3.3.3-elf-rpath.patch.1
@@ -5,18 +5,16 @@ set RPATH (only to be used on ELF platforms)
 diff -ru python3.orig/Makefile.pre.in python3/Makefile.pre.in
 --- python3.orig/Makefile.pre.in       2015-07-26 20:29:07.126194320 +0200
 +++ python3/Makefile.pre.in    2015-07-26 20:37:21.814227530 +0200
-@@ -550,7 +550,7 @@
+@@ -563,7 +563,7 @@
  
  # Build the interpreter
  $(BUILDPYTHON):       Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
--      $(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
+-      $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o 
$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
++      $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o 
$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) -Wl,-rpath,\$$ORIGIN
  
  platform: $(BUILDPYTHON) pybuilddir.txt
        $(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 @@
+@@ -625,7 +625,7 @@
        fi
  
  libpython3.so:        libpython$(LDVERSION).so
@@ -24,4 +22,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_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); \
+        $(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) $(DTRACE_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
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 416ab2c7b15b..52c007d7d5b6 100644
--- a/external/python3/python-3.5.4-msvc-disable.patch.1
+++ b/external/python3/python-3.5.4-msvc-disable.patch.1
@@ -12,7 +12,7 @@ diff -ru python3.orig/PCbuild/pcbuild.sln 
python3/PCbuild/pcbuild.sln
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winsound", 
"winsound.vcxproj", "{28B5D777-DDF2-4B6B-B34F-31D938813856}"
  EndProject
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_decimal", 
"_decimal.vcxproj", "{0E9791DB-593A-465F-98BC-681011311617}"
-@@ -28,32 +26,18 @@
+@@ -28,34 +26,20 @@
  EndProject
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_socket", 
"_socket.vcxproj", "{86937F53-C189-40EF-8CE8-8759D8E7D480}"
  EndProject
@@ -22,6 +22,8 @@ diff -ru python3.orig/PCbuild/pcbuild.sln 
python3/PCbuild/pcbuild.sln
  EndProject
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testcapi", 
"_testcapi.vcxproj", "{6901D91C-6E48-4BB7-9FEC-700C8131DF1D}"
  EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testinternalcapi", 
"_testinternalcapi.vcxproj", "{900342D7-516A-4469-B1AD-59A66E49A25F}"
+ EndProject
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testimportmultiple", 
"_testimportmultiple.vcxproj", "{36D0C52C-DF4E-45D0-8BC7-E294C3ABC781}"
  EndProject
 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_tkinter", 
"_tkinter.vcxproj", "{4946ECAC-2E69-4BF8-A90A-F5136F5094DF}"
commit e305f1514c3a2b235e59080853e6b88d68977369
Author:     Jan-Marek Glogowski <[email protected]>
AuthorDate: Tue Jul 14 23:20:06 2020 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:42 2022 +0100

    libffi: build DLL on Windows
    
    The build setup is rather horrible, with some minimal gcc MSVC
    wrapper. But the DLL is a prerequisite for the Python 3.8 build,
    which dropped the internal libffi.
    
    It's also possible to build it statically, but then you have to
    patch the Python 3 _ctypes msbuild properties.
    
    This also defaults to explicit --build and --host settings, even
    without a cross build, because the predicted name would otherwise
    differ (*-unknown-* instead of *-pc-*).
    
    Additionally a "make install" also fails...
    
    Change-Id: Ifb7dac840e23efffb9a5e342560aef9e11e0db79
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98436
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <[email protected]>
    (cherry picked from commit 883068462fe5bcbb01a8e14736fc06d0c3695c62)

diff --git a/configure.ac b/configure.ac
index 9941e04bcd75..cafb223193ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8803,7 +8803,7 @@ internal)
     fi
     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
     BUILD_TYPE="$BUILD_TYPE PYTHON"
-    if test "$OS" = LINUX; then
+    if test "$OS" = LINUX -o "$OS" = WNT ; then
         BUILD_TYPE="$BUILD_TYPE LIBFFI"
     fi
     # Embedded Python dies without Home set
diff --git a/external/libffi/ExternalPackage_libffi.mk 
b/external/libffi/ExternalPackage_libffi.mk
new file mode 100644
index 000000000000..212e63aa36af
--- /dev/null
+++ b/external/libffi/ExternalPackage_libffi.mk
@@ -0,0 +1,20 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalPackage_ExternalPackage,libffi,libffi))
+
+$(eval $(call gb_ExternalPackage_use_external_project,libffi,libffi))
+
+ifeq ($(COM),MSC)
+$(eval $(call gb_ExternalPackage_add_files,libffi,$(LIBO_LIB_FOLDER),\
+    $(HOST_PLATFORM)/.libs/libffi-7.dll \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libffi/ExternalProject_libffi.mk 
b/external/libffi/ExternalProject_libffi.mk
index bdf8fe61eb76..0ff625ea3e20 100644
--- a/external/libffi/ExternalProject_libffi.mk
+++ b/external/libffi/ExternalProject_libffi.mk
@@ -14,17 +14,34 @@ $(eval $(call gb_ExternalProject_register_targets,libffi,\
 ))
 
 # set prefix so that it ends up in libffi.pc so that pkg-config in python3 
works
+# For a static Windows build, change CPPFLAGS to include -D_LIB and 
--disable-static
+# Also remove the ExternalPackage in that case
+
+libffi_WIN_PLATFORM := $(strip \
+    $(if $(filter INTEL,$(CPUNAME)),32) \
+    $(if $(filter X86_64,$(CPUNAME)),64) \
+    $(if $(filter ARM64,$(CPUNAME)),arm64) \
+    )
 
 $(call gb_ExternalProject_get_state_target,libffi,build):
        $(call gb_ExternalProject_run,build,\
+               export LIB="$(ILIB)" && \
                ./configure \
                        --enable-option-checking=fatal \
-                       $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) 
--host=$(HOST_PLATFORM)) \
-                       --enable-static \
-                       --disable-shared \
-                       --with-pic \
-                       --enable-portable-binary \
-                       CC="$(CC) $(if $(filter 
LINUX,$(OS)),-fvisibility=hidden)" \
+                       --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
+                       $(if $(filter LINUX,$(OS)), \
+                           --disable-shared \
+                           CC="$(CC) -fvisibility=hidden" \
+                               --with-pic \
+                               --enable-portable-binary) \
+                       $(if $(filter WNT,$(OS)), \
+                           --disable-static \
+                           CC="$(call 
gb_UnpackedTarball_get_dir,libffi)/msvcc.sh -m$(libffi_WIN_PLATFORM)" \
+                           CXX="$(call 
gb_UnpackedTarball_get_dir,libffi)/msvcc.sh -m$(libffi_WIN_PLATFORM)" \
+                               LD='link' \
+                               CPP='cl -nologo -EP' \
+                               CXXCPP='cl -nologo -EP' \
+                               CPPFLAGS="-DFFI_BUILDING_DLL $(SOLARINC)") \
                        --prefix=$(call 
gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM) \
                        --disable-docs \
                && $(MAKE) \
diff --git a/external/libffi/Module_libffi.mk b/external/libffi/Module_libffi.mk
index 739fd4197000..ace75480abe3 100644
--- a/external/libffi/Module_libffi.mk
+++ b/external/libffi/Module_libffi.mk
@@ -12,6 +12,7 @@ $(eval $(call gb_Module_Module,libffi))
 $(eval $(call gb_Module_add_targets,libffi,\
        UnpackedTarball_libffi \
        ExternalProject_libffi \
+       ExternalPackage_libffi \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/python3/ExternalProject_python3.mk 
b/external/python3/ExternalProject_python3.mk
index 496db1523837..c47f8d84c2a8 100644
--- a/external/python3/ExternalProject_python3.mk
+++ b/external/python3/ExternalProject_python3.mk
@@ -11,7 +11,7 @@ $(eval $(call gb_ExternalProject_ExternalProject,python3))
 
 $(eval $(call gb_ExternalProject_use_externals,python3,\
        expat \
-       $(if $(filter LINUX,$(OS)),libffi) \
+       $(if $(filter WNT LINUX,$(OS)),libffi) \
        openssl \
        zlib \
 ))
commit 2b3b296115afed767e8c17e34fc49a7b38f9f192
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed May 20 11:35:09 2020 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:42 2022 +0100

    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 <[email protected]>
    (cherry picked from commit 0a3d414fb0ac27292320d99f802722a8a9670240)

diff --git a/pyuno/source/loader/pythonloader.py 
b/pyuno/source/loader/pythonloader.py
index 268cb168fe3c..0ecbf5d848a6 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('/')] )
commit d85eaa0fe79aee2e6159990412beeb67d4cb818e
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu May 14 12:56:56 2020 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:42 2022 +0100

    fix python 3.8 deprecation warnings
    
    the logo changes were caused by
    
    > Support of nested sets and set operations as in Unicode Technical Standard
    > #18 might be added in the future. This would change the syntax, so to 
facilitate
    > this change a FutureWarning will be raised in ambiguous cases for the 
time being.
    > That includes sets starting with a literal '[' or containing literal 
character
    > sequences '--', '&&', '~~', and '||'.
    > To avoid a warning escape them with a backslash.
    
    Change-Id: I4d48be3df2eaadf03a9d1f5750c0c94b3abbf674
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94191
    Tested-by: Noel Grandin <[email protected]>
    Reviewed-by: Noel Grandin <[email protected]>
    (cherry picked from commit b5fcdc3c07efb2c1175503b9c70e6d7336aa1452)

diff --git a/librelogo/source/LibreLogo/LibreLogo.py 
b/librelogo/source/LibreLogo/LibreLogo.py
index 2fa16ed81822..57ce696d288e 100644
--- a/librelogo/source/LibreLogo/LibreLogo.py
+++ b/librelogo/source/LibreLogo/LibreLogo.py
@@ -401,7 +401,7 @@ def __translate__(arg = None):
     text = selection.getString()
     # remove comments and strings
     text = re.sub(r"[ ]*;[^\n]*", "", 
re.sub(r"['„“‘«»「][^\n'”“‘’«»」]*['”“‘’«»」]", "", re.sub(r"^[ \t]*[;#][^\n]*", 
"", text)))
-    text = " ".join(set(re.findall("(?u)\w+", text)) - 
set(re.findall("(?u)\w*\d+\w*", text))).lower()  # only words
+    text = " ".join(set(re.findall(r"(?u)\w+", text)) - 
set(re.findall(r"(?u)\w*\d+\w*", text))).lower()  # only words
     ctx = uno.getComponentContext()
     guess = 
ctx.ServiceManager.createInstanceWithContext("com.sun.star.linguistic2.LanguageGuessing",
 ctx)
     guess.disableLanguages(guess.getEnabledLanguages())
@@ -424,7 +424,7 @@ def __translate__(arg = None):
 
     text = re.sub(r"^(([ \t]*[;#][^\n]*))", __encodecomment__, text)
     text = re.sub("(?u)([%s])((?:[^\n%s]|\\\\[%s])*)(?<!\\\\)[%s]" % (lq, rq, 
rq, rq), __encodestring__, selection.getString())
-    text = re.sub('(?u)(?<![0-9])(")(~?\w*)', __encodestring__, text)
+    text = re.sub(r'(?u)(?<![0-9])(")(~?\w*)', __encodestring__, text)
     text = re.sub(r";(([^\n]*))", __encodecomment__, text)
 
     # translate the program to the language of the document FIXME space/tab
@@ -433,12 +433,12 @@ def __translate__(arg = None):
     in2 = __l12n__(_.lng)['IN'].split("|")[0].upper()
     if in1[0] == '-' and in2[0] != '-': # "for x y-in" -> "for x in y"
         exception += ['IN']
-        text = re.sub(r"(?ui)\b((?:%s) +:?\w+) +([^\n]+)(?:%s) +(?=[[] 
|[[]\n)" % (lang['FOR'], in1), "\\1 %s \\2 " % in2, text)
-        text = re.sub(r"(?ui)(:?\b\w+|[[][^[\n]*])\b(?:%s)\b" % in1, "%s \\1" 
% in2, text)
+        text = re.sub(r"(?ui)\b((?:%s) +:?\w+) +([^\n]+)(?:%s) +(?=[\[] 
|[\[]\n)" % (lang['FOR'], in1), "\\1 %s \\2 " % in2, text)
+        text = re.sub(r"(?ui)(:?\b\w+|[\[][^[\n]*])\b(?:%s)\b" % in1, "%s \\1" 
% in2, text)
     elif in1[0] != '-' and in2[0] == '-': # "for x in y" -> "for x y-in"
         exception += ['IN']
-        text = re.sub(r"(?ui)(?<=\n)((?:%s)\b +:?\w+) +(?:%s) +([^\n]+?) 
+(?=[[] |[[]\n)" % (lang['FOR'], in1), "\\1 \\2%s " % in2, text)
-        text = re.sub(r"(?ui)(?<!:)\b(?:%s) +(:?\b\w+|[[][^[\n]*])\b" % in1, 
"\\1%s" % in2, text)
+        text = re.sub(r"(?ui)(?<=\n)((?:%s)\b +:?\w+) +(?:%s) +([^\n]+?) 
+(?=[\[] |[\[]\n)" % (lang['FOR'], in1), "\\1 \\2%s " % in2, text)
+        text = re.sub(r"(?ui)(?<!:)\b(?:%s) +(:?\b\w+|[\[][^[\n]*])\b" % in1, 
"\\1%s" % in2, text)
     for i in set(lang) - set(exception):
         text = re.sub(r'(?ui)(?<!:)\b(%s)\b' % lang[i], 
__l12n__(_.lng)[i].split("|")[0].upper(), text)
     text = re.sub(r"(?<=\d)[%s](?=\d)" % lang['DECIMAL'], 
__l12n__(_.lng)['DECIMAL'], text)
@@ -554,9 +554,9 @@ class LogoProgram(threading.Thread):
                         MessageBox(parent, __l12n__(_.lng)['ERR_ARGUMENTS'] % 
(__locname__('REPEAT'), 1, 0), caption, "errorbox")
                     else:
                         MessageBox(parent, __l12n__(_.lng)['ERR_NAME'] % \
-                            to_unicode(re.search("(?<=name ')[\w_]*(?=')", 
message).group(0)), caption, "errorbox")
+                            to_unicode(re.search(r"(?<=name ')[\w_]*(?=')", 
message).group(0)), caption, "errorbox")
                 elif "TypeError" in message and "argument" in message and 
"given" in message:
-                    r = re.search("([\w_]*)[(][)][^\n]* (\w+) arguments? 
[(](\d+)", message) # XXX later: handle 'no arguments' + plural
+                    r = re.search(r"([\w_]*)[(][)][^\n]* (\w+) arguments? 
[(](\d+)", message) # XXX later: handle 'no arguments' + plural
                     MessageBox(parent, __l12n__(_.lng)['ERR_ARGUMENTS'] % 
(__locname__(r.group(1)), r.group(2), r.group(3)), caption, "errorbox")
                 else:
                     origline = __compiled__.split("\n")[line-1]
@@ -1541,7 +1541,7 @@ def create_svg_animation(m):
 def create_valid_svg_file(filename):
     with open(filename, "r") as f:
         s = f.read()
-    s = re.sub('(?s)(<g\\sid="[^"]*)\(([^"]*)\)', '\\1\\2', s) # bad "(", ")" 
in xml:id
+    s = re.sub(r'(?s)(<g\sid="[^"]*)\(([^"]*)\)', '\\1\\2', s) # bad "(", ")" 
in xml:id
     s = re.sub('(?s)<g\\sooo:[^>]*>', '', s) # remove non standard attributes
     s = re.sub('(?s)<defs class="EmbeddedBulletChars">.*(?=<defs 
class="TextEmbeddedBitmaps")', '', s) # remove unused parts
     s = re.sub('(?s)(<path stroke-width="[^"]*"[^<]*)stroke-width="[^"]*"', 
'\\1', s) # double stroke-width
@@ -1676,7 +1676,7 @@ def __loadlang__(lang, a):
     [r"(?<!:)\b(?:%s)\b" % a['OUTPUT'], "\nreturn"],
     [r"\n(if|while|return) [^\n]*", lambda r: re.sub("(?<![=!<>])=(?!=)", 
"==", r.group(0))], # = -> ==, XXX x = y = 1?
     [r"(?<=\n)(for\b :?\w+) ([^\n]+)(?<=\w|]|}|\))(?=-|:)(?:%s)\b" % a['IN'], 
"\\1 in \\2"], # "for x y-in" -> "for x in y"
-    [r"(:?\b\w+|[[][^[\n]*])\b(?:%s)\b" % a['IN'], "in \\1"], # "x y-in" -> "x 
in y"
+    [r"(:?\b\w+|[\[][^[\n]*])\b(?:%s)\b" % a['IN'], "in \\1"], # "x y-in" -> 
"x in y"
     [r"(?<!:)\b(?:%s)\b" % a['IN'], "in"],
     [r"(?<!:)\b(?:%s)\b[ \t]+(:?\w+)\b(?! in\b)" % a['FOR'], "\nfor \\1 in"],
     [r"(?<=\n)__repeat__ :\n", "while True:\n"], # infinite loop
@@ -1755,7 +1755,7 @@ def __loadlang__(lang, a):
     [r"(?<!:)\b(?:%s)\b ?\(" % a['RESUB'], "re.sub('(?u)'+"],
     [r"(?<!:)\b(?:%s)\b ?\(" % a['REFINDALL'], "re.findall('(?u)'+"],
     [r"(?<!:)\b(?:%s)\b" % a['ANY'], "u'any'"],
-    [r"(?<!:)\b(?:%s) (\w+|[[][^\]]*])\b" % a['INPUT'], " Input(\\1)"],
+    [r"(?<!:)\b(?:%s) (\w+|[\[][^\]]*])\b" % a['INPUT'], " Input(\\1)"],
     [r"(?<!:)\b(?:%s)\b" % a['PRINT'], "\nPrint"],
     [r"(?<!:)\b(?:%s)\b" % a['TURNLEFT'], "\n)turnleft("],
     [r"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['PT'], "\\1"],
@@ -1904,7 +1904,7 @@ def __compil__(s):
     rq = '\'' + __l12n__(_.lng)['RIGHTSTRING'].replace("|", "")
     __strings__ = []
     s = re.sub("(?u)([%s])((?:[^\n%s]|\\\\[%s])*)(?<!\\\\)[%s]" % (lq, rq, rq, 
rq), __encodestring__, s)
-    s = re.sub('(?u)(?<![0-9])(")(~?\w*)', __encodestring__, s)
+    s = re.sub(r'(?u)(?<![0-9])(")(~?\w*)', __encodestring__, s)
 
     # remove extra spaces
     s = chsp.sub(" ", s)
@@ -1918,7 +1918,7 @@ def __compil__(s):
     # replace procedure names
     s = re.sub(r"(?i)^[ ]*(%s)[ ]+" % __l12n__(_.lng)['TO'], "__def__ ", s)
     s = re.sub(r"(?i)\n[ ]*(%s)[ ]+" % __l12n__(_.lng)['TO'], "\n__def__ ", s)
-    subnames = re.findall(u"(?iu)(?<=__def__ )\w+", s)
+    subnames = re.findall(r"(?iu)(?<=__def__ )\w+", s)
     globs = ""
     functions = ["range", "__int__", "__float__", "Random", "Input", 
"__string__", "len", "round", "abs", "sin", "cos", "sqrt", "log10", "set", 
"list", "tuple", "re.sub", "re.search", "re.findall", "sorted", "min", "max"]
     defaultfunc = ["Print"] # TODO handle all default procedures
@@ -1930,7 +1930,7 @@ def __compil__(s):
         firstend = ends.split("|")[0]
         s = re.sub(r"(?<!:)\b(?:%s)\b" % ends, firstend, s)
         __l12n__(_.lng)["END"] = firstend
-        functions += [ re.findall("(?u)\w+",i[0])[0]  for i in 
re.findall(r"""(?iu)(?<=__def__ )([^\n]*)\n # beginning of a procedure
+        functions += [ re.findall(r"(?u)\w+",i[0])[0]  for i in 
re.findall(r"""(?iu)(?<=__def__ )([^\n]*)\n # beginning of a procedure
             (?:[^\n]*(?<!\b(%(END)s))\n)* # 0 or more lines (not END)
             [^\n]*\b(?:%(OUTPUT)s)\b[^\n]*\n # line with OUTPUT (functions = 
procedures with OUTPUT)
             (?:[^\n]*(?<!\b(?:%(END)s))\n)* # 0 or more lines (not END)
@@ -1939,7 +1939,7 @@ def __compil__(s):
         # add line breaks before procedure calls
         procedures = set(subnames) - set(functions)
         if len(procedures) > 0:
-            s = re.sub(r"(?<!__def__)(?<![-+=*/])(?<!%s)(?:^|[ \t]+)(" % 
")(?<!".join(functions) + "|".join(procedures) + ")(?!\w)", r"\n\1", s)
+            s = re.sub(r"(?<!__def__)(?<![-+=*/])(?<!%s)(?:^|[ \t]+)(" % 
")(?<!".join(functions) + "|".join(procedures) + r")(?!\w)", r"\n\1", s)
 
     # substitute LibreLogo functions and specifiers with their Python 
equivalents
     for i in __comp__[_.lng]:
@@ -1947,12 +1947,12 @@ def __compil__(s):
 
     indent = 0 # Python indentation level
     result = ""
-    func = re.compile("(?iu)(def (\w+))(\(.*\):)")
+    func = re.compile(r"(?iu)(def (\w+))(\(.*\):)")
 
     # compile to Python
     subroutines = re.compile(r"(?iu)(?<!def )(?<![_\w])\b(%s)\b(?![\w(])" % 
"|".join(subnames + functions + defaultfunc))
     operators = re.compile(r"(?iu)(%s)" % "(?:[ ]*([+*/<>]|//|==|<=|>=|<>|!=)[ 
]*|[ ]*-[ ]+|(?<! )-[ ]*|[ ]*[*][*][ ]*)") # operators, eg. " - ", "-", "- "
-    atoms = re.compile(r"(?iu)(%s)" % "[0-9]+([.,][0-9]+)?|:?\w+([.]\w)?")
+    atoms = re.compile(r"(?iu)(%s)" % r"[0-9]+([.,][0-9]+)?|:?\w+([.]\w)?")
 
     # store argument numbers of all subroutines in dictionary "names"
     names = {key: 1 for key in functions + defaultfunc}
diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index 82973266a2b0..912f1b511185 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -21,7 +21,7 @@ import uno
 import unohelper
 import sys
 import os
-import imp
+import types
 import time
 import ast
 import platform
@@ -347,7 +347,7 @@ class ScriptContext(unohelper.Base):
 #        code = readTextFromStream( sfa.openFileRead( url ) )
 
         # execute the module
-#        entry = ModuleEntry( lastRead, imp.new_module("ooo_script_framework") 
)
+#        entry = ModuleEntry( lastRead, 
types.ModuleType("ooo_script_framework") )
 #        entry.module.__dict__[GLOBAL_SCRIPTCONTEXT_NAME] = g_scriptContext
 #        entry.module.__file__ = url
 #        exec code in entry.module.__dict__
@@ -489,7 +489,7 @@ class ProviderContext:
             src = ensureSourceState( src )
 
             # execute the module
-            entry = ModuleEntry( lastRead, 
imp.new_module("ooo_script_framework") )
+            entry = ModuleEntry( lastRead, 
types.ModuleType("ooo_script_framework") )
             entry.module.__dict__[GLOBAL_SCRIPTCONTEXT_NAME] = 
self.scriptContext
 
             code = None
@@ -583,7 +583,7 @@ class ScriptBrowseNode( unohelper.Base, XBrowseNode , 
XPropertySet, XInvocation,
             if event.ActionCommand == "Run":
                 code = self.editor.getControl("EditorTextField").getText()
                 code = ensureSourceState( code )
-                mod = imp.new_module("ooo_script_framework")
+                mod = types.ModuleType("ooo_script_framework")
                 mod.__dict__[GLOBAL_SCRIPTCONTEXT_NAME] = 
self.provCtx.scriptContext
                 exec(code, mod.__dict__)
                 values = mod.__dict__.get( CALLABLE_CONTAINER_NAME , None )
commit 11c5e26f49a302ac3394931fbfd70f247d1ec145
Author:     Xisco Fauli <[email protected]>
AuthorDate: Wed Nov 2 20:29:51 2022 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:41 2022 +0100

    upgrade to openssl-1.1.1s
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142184
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>
    (cherry picked from commit 23e6227ab347a00b235fb00892b379ef4e3a0d35)
    
    Change-Id: Ic0f1fca7ef73b3a443c24d2bcc7f234be331a05b

diff --git a/download.lst b/download.lst
index 9d070f1a8b47..fd2cbcdc163e 100644
--- a/download.lst
+++ b/download.lst
@@ -194,8 +194,8 @@ export OFFICEOTRON_SHA256SUM := 
f2443f27561af52324eee03a1892d9f569adc8db9e7bca55
 export OFFICEOTRON_JAR := 
8249374c274932a21846fa7629c2aa9b-officeotron-0.7.4-master.jar
 export OPENLDAP_SHA256SUM := 
99f37d6747d88206c470067eda624d5e48c1011e943ec0ab217bae8712e22f34
 export OPENLDAP_TARBALL := openldap-2.4.59.tgz
-export OPENSSL_SHA256SUM := 
d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca
-export OPENSSL_TARBALL := openssl-1.1.1q.tar.gz
+export OPENSSL_SHA256SUM := 
c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa
+export OPENSSL_TARBALL := openssl-1.1.1s.tar.gz
 export ORCUS_SHA256SUM := 
0dd26f3f2e611c51df9ee02d6dbf08887989eaa417b73f6877cd0d94df795fc2
 export ORCUS_TARBALL := liborcus-0.15.3.tar.gz
 export OWNCLOUD_ANDROID_LIB_SHA256SUM := 
b18b3e3ef7fae6a79b62f2bb43cc47a5346b6330f6a383dc4be34439aca5e9fb
commit a15c09c6c0ace749d89168841305e797722d7c7d
Author:     Taichi Haradaguchi <[email protected]>
AuthorDate: Tue Sep 6 14:42:20 2022 +0900
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:41 2022 +0100

    upgrade openssl-1.1.1q
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139463
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>
    (cherry picked from commit 96db5e3d610ede2ed82f1ab7673ac6d1c69fd588)
    
    Change-Id: I2317e734f074cf7301a6081cf3d2221beeaf5ad1

diff --git a/download.lst b/download.lst
index 0ec20062c9d0..9d070f1a8b47 100644
--- a/download.lst
+++ b/download.lst
@@ -194,8 +194,8 @@ export OFFICEOTRON_SHA256SUM := 
f2443f27561af52324eee03a1892d9f569adc8db9e7bca55
 export OFFICEOTRON_JAR := 
8249374c274932a21846fa7629c2aa9b-officeotron-0.7.4-master.jar
 export OPENLDAP_SHA256SUM := 
99f37d6747d88206c470067eda624d5e48c1011e943ec0ab217bae8712e22f34
 export OPENLDAP_TARBALL := openldap-2.4.59.tgz
-export OPENSSL_SHA256SUM := 
f89199be8b23ca45fc7cb9f1d8d3ee67312318286ad030f5316aca6462db6c96
-export OPENSSL_TARBALL := openssl-1.1.1m.tar.gz
+export OPENSSL_SHA256SUM := 
d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca
+export OPENSSL_TARBALL := openssl-1.1.1q.tar.gz
 export ORCUS_SHA256SUM := 
0dd26f3f2e611c51df9ee02d6dbf08887989eaa417b73f6877cd0d94df795fc2
 export ORCUS_TARBALL := liborcus-0.15.3.tar.gz
 export OWNCLOUD_ANDROID_LIB_SHA256SUM := 
b18b3e3ef7fae6a79b62f2bb43cc47a5346b6330f6a383dc4be34439aca5e9fb
commit 4329a95e9cc4bfe2dc3463bb266a4db376ce4f4a
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sat Jan 22 12:55:40 2022 +0000
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:41 2022 +0100

    upgrade to openssl-1.1.1m
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128769
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>
    (cherry picked from commit 0f2b8305ed31746cd4dca33aa080adb220109353)
    
    Change-Id: I7c3e576501b4587a0f6814cdc4895663ef6d3f79

diff --git a/download.lst b/download.lst
index 6f2a84c6fab4..0ec20062c9d0 100644
--- a/download.lst
+++ b/download.lst
@@ -194,8 +194,8 @@ export OFFICEOTRON_SHA256SUM := 
f2443f27561af52324eee03a1892d9f569adc8db9e7bca55
 export OFFICEOTRON_JAR := 
8249374c274932a21846fa7629c2aa9b-officeotron-0.7.4-master.jar
 export OPENLDAP_SHA256SUM := 
99f37d6747d88206c470067eda624d5e48c1011e943ec0ab217bae8712e22f34
 export OPENLDAP_TARBALL := openldap-2.4.59.tgz
-export OPENSSL_SHA256SUM := 
0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1
-export OPENSSL_TARBALL := openssl-1.1.1l.tar.gz
+export OPENSSL_SHA256SUM := 
f89199be8b23ca45fc7cb9f1d8d3ee67312318286ad030f5316aca6462db6c96
+export OPENSSL_TARBALL := openssl-1.1.1m.tar.gz
 export ORCUS_SHA256SUM := 
0dd26f3f2e611c51df9ee02d6dbf08887989eaa417b73f6877cd0d94df795fc2
 export ORCUS_TARBALL := liborcus-0.15.3.tar.gz
 export OWNCLOUD_ANDROID_LIB_SHA256SUM := 
b18b3e3ef7fae6a79b62f2bb43cc47a5346b6330f6a383dc4be34439aca5e9fb
commit 4383adcf8b69bdeb5b1dc8cfc971ff4d957f6bf8
Author:     Michael Stahl <[email protected]>
AuthorDate: Wed Aug 25 11:16:46 2021 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:41 2022 +0100

    openssl: upgrade to release 1.1.1l
    
    Fixes CVE-2021-3712, CVE-2021-3711 (not obvious if any of them affect LO)
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121026
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit 5c391f4346e86bd5d7528fbb42a3af64f98a03d3)
    
    Change-Id: I98652348977a5a3c728f1d4fdf7293b76a93b630

diff --git a/download.lst b/download.lst
index 86275e467987..6f2a84c6fab4 100644
--- a/download.lst
+++ b/download.lst
@@ -194,8 +194,8 @@ export OFFICEOTRON_SHA256SUM := 
f2443f27561af52324eee03a1892d9f569adc8db9e7bca55
 export OFFICEOTRON_JAR := 
8249374c274932a21846fa7629c2aa9b-officeotron-0.7.4-master.jar
 export OPENLDAP_SHA256SUM := 
99f37d6747d88206c470067eda624d5e48c1011e943ec0ab217bae8712e22f34
 export OPENLDAP_TARBALL := openldap-2.4.59.tgz
-export OPENSSL_SHA256SUM := 
892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5
-export OPENSSL_TARBALL := openssl-1.1.1k.tar.gz
+export OPENSSL_SHA256SUM := 
0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1
+export OPENSSL_TARBALL := openssl-1.1.1l.tar.gz
 export ORCUS_SHA256SUM := 
0dd26f3f2e611c51df9ee02d6dbf08887989eaa417b73f6877cd0d94df795fc2
 export ORCUS_TARBALL := liborcus-0.15.3.tar.gz
 export OWNCLOUD_ANDROID_LIB_SHA256SUM := 
b18b3e3ef7fae6a79b62f2bb43cc47a5346b6330f6a383dc4be34439aca5e9fb
commit 96806bd52334f8a71b9d8617d08e27975752fb50
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sat Aug 14 19:03:24 2021 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:41 2022 +0100

    upgrade to openssl-1.1.1k
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120490
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>
    (cherry picked from commit c6604b69cf7f84146cae541366c023eaff4c59b6)
    
    Change-Id: Ibd930ab4f97e2f74868b73163d7f2f46fb466749

diff --git a/download.lst b/download.lst
index 114d496506be..86275e467987 100644
--- a/download.lst
+++ b/download.lst
@@ -194,8 +194,8 @@ export OFFICEOTRON_SHA256SUM := 
f2443f27561af52324eee03a1892d9f569adc8db9e7bca55
 export OFFICEOTRON_JAR := 
8249374c274932a21846fa7629c2aa9b-officeotron-0.7.4-master.jar
 export OPENLDAP_SHA256SUM := 
99f37d6747d88206c470067eda624d5e48c1011e943ec0ab217bae8712e22f34
 export OPENLDAP_TARBALL := openldap-2.4.59.tgz
-export OPENSSL_SHA256SUM := 
e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242
-export OPENSSL_TARBALL := openssl-1.1.1i.tar.gz
+export OPENSSL_SHA256SUM := 
892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5
+export OPENSSL_TARBALL := openssl-1.1.1k.tar.gz
 export ORCUS_SHA256SUM := 
0dd26f3f2e611c51df9ee02d6dbf08887989eaa417b73f6877cd0d94df795fc2
 export ORCUS_TARBALL := liborcus-0.15.3.tar.gz
 export OWNCLOUD_ANDROID_LIB_SHA256SUM := 
b18b3e3ef7fae6a79b62f2bb43cc47a5346b6330f6a383dc4be34439aca5e9fb
commit aff7167221ff3b6784dbcf3763ea7774aafc7638
Author:     Michael Stahl <[email protected]>
AuthorDate: Tue Jan 5 13:45:43 2021 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:40 2022 +0100

    openssl: upgrade to release 1.1.1i
    
    Fixes CVE-2020-1971
    
    * openssl-macos-arm64.patch.1: remove, was fixed upstream
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108804
    Tested-by: Michael Stahl <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit adfceaf32651f6ef17a9b63906366818b667d6b5)
    
    Change-Id: I405270228682025bf26240e3ea923bfd234068f5

diff --git a/download.lst b/download.lst
index 0fbfd0136175..114d496506be 100644
--- a/download.lst
+++ b/download.lst
@@ -194,8 +194,8 @@ export OFFICEOTRON_SHA256SUM := 
f2443f27561af52324eee03a1892d9f569adc8db9e7bca55
 export OFFICEOTRON_JAR := 
8249374c274932a21846fa7629c2aa9b-officeotron-0.7.4-master.jar
 export OPENLDAP_SHA256SUM := 
99f37d6747d88206c470067eda624d5e48c1011e943ec0ab217bae8712e22f34
 export OPENLDAP_TARBALL := openldap-2.4.59.tgz
-export OPENSSL_SHA256SUM := 
ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
-export OPENSSL_TARBALL := openssl-1.1.1g.tar.gz
+export OPENSSL_SHA256SUM := 
e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242
+export OPENSSL_TARBALL := openssl-1.1.1i.tar.gz
 export ORCUS_SHA256SUM := 
0dd26f3f2e611c51df9ee02d6dbf08887989eaa417b73f6877cd0d94df795fc2
 export ORCUS_TARBALL := liborcus-0.15.3.tar.gz
 export OWNCLOUD_ANDROID_LIB_SHA256SUM := 
b18b3e3ef7fae6a79b62f2bb43cc47a5346b6330f6a383dc4be34439aca5e9fb
commit f1ad933657147796a29bab03838e8dde4a1276a9
Author:     Michael Stahl <[email protected]>
AuthorDate: Sat Nov 7 17:51:27 2020 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:40 2022 +0100

    configure: OpenSSL needs perl-FindBin to build
    
    Change-Id: Idcea17d2418a2e847a5713293d7a225ed86bd305
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105435
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit 03a9a80125cf887d26348486b71d78d80c99344d)

diff --git a/configure.ac b/configure.ac
index 7b09dc9b3244..9941e04bcd75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5368,6 +5368,10 @@ fi
 if test "$with_system_hsqldb" = "yes"; then
     perl_use_string="$perl_use_string ; use Archive::Zip"
 fi
+if test "$with_system_openssl" != "yes"; then
+    # OpenSSL needs that to build
+    perl_use_string="$perl_use_string ; use FindBin"
+fi
 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
     AC_MSG_RESULT([all modules found])
 else
commit 1588dfebdf4f3766b4768114f124b0e260d5465f
Author:     Michael Stahl <[email protected]>
AuthorDate: Fri Dec 9 14:22:45 2022 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 9 18:50:40 2022 +0100

    openssl: remove obsolete 1.0.2 patches
    
    Change-Id: I858998434b3cd1668c6d9522ce6d57f928802a8f

diff --git a/external/openssl/ccb0a11145ee72b042d10593a64eaf9e8a55ec12.patch.1 
b/external/openssl/ccb0a11145ee72b042d10593a64eaf9e8a55ec12.patch.1
deleted file mode 100644
index cf809750ecfb..000000000000
--- a/external/openssl/ccb0a11145ee72b042d10593a64eaf9e8a55ec12.patch.1
+++ /dev/null
@@ -1,56 +0,0 @@
-From ccb0a11145ee72b042d10593a64eaf9e8a55ec12 Mon Sep 17 00:00:00 2001
-From: Matt Caswell <[email protected]>
-Date: Tue, 17 Aug 2021 14:41:48 +0100
-Subject: [PATCH] Fix a read buffer overrun in X509_CERT_AUX_print()
-
-This is a backport of commit c5dc9ab965f to 1.0.2. That commit fixed
-the same bug but in master/1.1.1 it is in the function X509_aux_print().
-The original commit had the following description:
-
-Fix a read buffer overrun in X509_aux_print().
-
-The ASN1_STRING_get0_data(3) manual explitely cautions the reader
-that the data is not necessarily NUL-terminated, and the function
-X509_alias_set1(3) does not sanitize the data passed into it in any
-way either, so we must assume the return value from X509_alias_get0(3)
-is merely a byte array and not necessarily a string in the sense
-of the C language.
-
-I found this bug while writing manual pages for X509_print_ex(3)
-and related functions.  Theo Buehler <[email protected]> checked my
-patch to fix the same bug in LibreSSL, see
-
-http://cvsweb.openbsd.org/src/lib/libcrypto/asn1/t_x509a.c#rev1.9
-
-As an aside, note that the function still produces incomplete and

... etc. - the rest is truncated

Reply via email to