Makefile.fetch                                                                 
    |    1 
 RepositoryExternal.mk                                                          
    |    8 
 bin/check-elf-dynamic-objects                                                  
    |    3 
 configure.ac                                                                   
    |    7 
 download.lst                                                                   
    |    6 
 external/Module_external.mk                                                    
    |    1 
 external/libffi/ExternalPackage_libffi.mk                                      
    |   20 
 external/libffi/ExternalProject_libffi.mk                                      
    |   33 
 external/libffi/Makefile                                                       
    |    7 
 external/libffi/Module_libffi.mk                                               
    |   17 
 external/libffi/README                                                         
    |    3 
 external/libffi/UnpackedTarball_libffi.mk                                      
    |   14 
 external/openssl/ExternalPackage_openssl.mk                                    
    |    8 
 external/openssl/ExternalProject_openssl.mk                                    
    |    2 
 
external/python3/0001-3.6-bpo-17239-Disable-external-entities-in-SAX-parse.patch.1
 |   59 -
 
external/python3/0001-3.6-closes-bpo-42938-Replace-snprintf-with-Python-un.patch.1
 |  175 -----
 external/python3/0001-remove-long-double-from-ctypes-value-union.patch.1       
    |   34 -
 external/python3/ExternalPackage_python3.mk                                    
    |  334 +++++-----
 external/python3/ExternalProject_python3.mk                                    
    |   48 +
 external/python3/UnpackedTarball_python3.mk                                    
    |   16 
 external/python3/i100492-freebsd.patch.1                                       
    |   49 -
 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                                   
    |   22 
 external/python3/python-3.3.0-pythreadstate.patch.1                            
    |   15 
 external/python3/python-3.3.3-aix.patch.1                                      
    |  146 ----
 external/python3/python-3.3.3-disable-obmalloc.patch.0                         
    |   23 
 external/python3/python-3.3.3-elf-rpath.patch.1                                
    |   15 
 external/python3/python-3.5.4-msvc-disable.patch.1                             
    |   21 
 external/python3/python-3.5.4-ssl.patch.1                                      
    |   94 --
 external/python3/python-3.5.tweak.strip.soabi.patch                            
    |    2 
 external/python3/python-3.7.6-msvc-ssl.patch.1                                 
    |   25 
 external/python3/python3-osx-avoid-new-10.13.patch.1                           
    |   61 -
 external/python3/ubsan.patch.0                                                 
    |   45 -
 pyuno/inc/pyuno.hxx                                                            
    |    1 
 pyuno/source/module/pyuno.cxx                                                  
    |    9 
 pyuno/source/module/pyuno_runtime.cxx                                          
    |   31 
 readlicense_oo/license/license.xml                                             
    |   23 
 38 files changed, 476 insertions(+), 937 deletions(-)

New commits:
commit ad0a5b92ac72fd8df40c0aad4fdd2be5ecc39b3f
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Jun 7 11:16:03 2023 +0200
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Thu Jul 27 16:52:46 2023 +0200

    python3: upgrade to release 3.8.17
    
    Fixes CVE-2023-24329 and a few more obscure security issues.
    
    Change-Id: I4b073ce02c0377e2791e4593d20f2b756de0c8cd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152696
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/configure.ac b/configure.ac
index 3c80d4da0bb2..055fbaae4048 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8750,7 +8750,7 @@ internal)
     SYSTEM_PYTHON=
     PYTHON_VERSION_MAJOR=3
     PYTHON_VERSION_MINOR=8
-    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.16
+    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.17
     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 3e9f057107e0..52b288084c4d 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 := 
5bbcf5a56d85c44f3a8b058fb46862ff49cbc91834d07e295d02e6de3c216df2
 export POSTGRESQL_TARBALL := postgresql-13.10.tar.bz2
-export PYTHON_SHA256SUM := 
d85dbb3774132473d8081dcb158f34a10ccad7a90b96c7e50ea4bb61f5ce4562
-export PYTHON_TARBALL := Python-3.8.16.tar.xz
+PYTHON_SHA256SUM := 
2e54b0c68191f16552f6de2e97a2396540572a219f6bbb28591a137cecc490a9
+PYTHON_TARBALL := Python-3.8.17.tar.xz
 export QXP_SHA256SUM := 
e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
 export QXP_TARBALL := libqxp-0.0.2.tar.xz
 export RAPTOR_SHA256SUM := 
ada7f0ba54787b33485d090d3d2680533520cd4426d2f7fb4782dd4a6a1480ed
diff --git a/external/python3/python-3.3.0-darwin.patch.1 
b/external/python3/python-3.3.0-darwin.patch.1
index 39d3c9180a19..d262d55cd5b3 100644
--- a/external/python3/python-3.3.0-darwin.patch.1
+++ b/external/python3/python-3.3.0-darwin.patch.1
@@ -49,7 +49,7 @@ diff -ru python3.orig/Mac/Resources/app/Info.plist.in 
python3/Mac/Resources/app/
 -      <string>Python</string>
 +      <string>LibreOfficePython</string>
        <key>CFBundleGetInfoString</key>
-       <string>%version%, (c) 2001-2020 Python Software Foundation.</string>
+       <string>%version%, (c) 2001-2023 Python Software Foundation.</string>
        <key>CFBundleHelpBookFolder</key>
 diff -ru python3.orig/Mac/Resources/framework/Info.plist.in 
python3/Mac/Resources/framework/Info.plist.in
 --- python3.orig/Mac/Resources/framework/Info.plist.in 2015-07-05 
18:50:07.000000000 +0200
commit 4cc73efa0ad421214b122a4bfaf655b258d22a51
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Dec 9 11:51:22 2022 +0100
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Thu Jul 27 16:18:14 2023 +0200

    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.
    
    Change-Id: I10fd254f7f0801d47119234bb3436874e98d8c91
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143849
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/configure.ac b/configure.ac
index c73f8cecc81a..3c80d4da0bb2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8750,7 +8750,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 a1abd118c435..3e9f057107e0 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 := 
5bbcf5a56d85c44f3a8b058fb46862ff49cbc91834d07e295d02e6de3c216df2
 export POSTGRESQL_TARBALL := postgresql-13.10.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 QXP_SHA256SUM := 
e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
 export QXP_TARBALL := libqxp-0.0.2.tar.xz
 export RAPTOR_SHA256SUM := 
ada7f0ba54787b33485d090d3d2680533520cd4426d2f7fb4782dd4a6a1480ed
commit 29a5bdb3de3c8f8c0a2c22e3a4eae99823b90aff
Author:     Taichi Haradaguchi <20001...@ymail.ne.jp>
AuthorDate: Mon Oct 24 00:52:04 2022 +0900
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Thu Jul 27 15:18:41 2023 +0200

    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
    
    Change-Id: I8e71f9a6b013ca4c45bf8774b284be98eee71bab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141691
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/configure.ac b/configure.ac
index 138f4f1dd7f0..c73f8cecc81a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8750,7 +8750,7 @@ internal)
     SYSTEM_PYTHON=
     PYTHON_VERSION_MAJOR=3
     PYTHON_VERSION_MINOR=8
-    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.14
+    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 e00ed8cef23a..a1abd118c435 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 := 
5bbcf5a56d85c44f3a8b058fb46862ff49cbc91834d07e295d02e6de3c216df2
 export POSTGRESQL_TARBALL := postgresql-13.10.tar.bz2
-export PYTHON_SHA256SUM := 
5d77e278271ba803e9909a41a4f3baca006181c93ada682a5e5fe8dc4a24c5f3
-export PYTHON_TARBALL := Python-3.8.14.tar.xz
+export PYTHON_SHA256SUM := 
5114fc7918a2a5e20eb5aac696b30c36f412c6ef24b13f5c9eb9e056982d9550
+export PYTHON_TARBALL := Python-3.8.15.tar.xz
 export QXP_SHA256SUM := 
e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
 export QXP_TARBALL := libqxp-0.0.2.tar.xz
 export RAPTOR_SHA256SUM := 
ada7f0ba54787b33485d090d3d2680533520cd4426d2f7fb4782dd4a6a1480ed
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 m...@openoffice.org
 
 --- 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 m...@openoffice.org
  #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 m...@openoffice.org
      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 14e7cca0a8ce..ca41f13b6ca5 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 938acc1f1725..d44fbe055c86 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
+@@ -13998,6 +13998,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
+@@ -554,7 +554,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 86793fe92e09085d0d76fea05c428df6dbbbc557
Author:     Taichi Haradaguchi <20001...@ymail.ne.jp>
AuthorDate: Sat Sep 10 17:20:58 2022 +0900
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Thu Jul 27 15:12:47 2023 +0200

    Python3: upgrade to release 3.8.14
    
    Fixes CVE-2020-10735.
    
    Change-Id: I028bb1fe6154beffdd80c0190c9de40ab8a80c4c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139747
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/configure.ac b/configure.ac
index 657706fab568..138f4f1dd7f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8750,7 +8750,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}.14
     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 8319fdb31b6d..e00ed8cef23a 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 := 
5bbcf5a56d85c44f3a8b058fb46862ff49cbc91834d07e295d02e6de3c216df2
 export POSTGRESQL_TARBALL := postgresql-13.10.tar.bz2
-export PYTHON_SHA256SUM := 
6f309077012040aa39fe8f0c61db8c0fa1c45136763299d375c9e5756f09cf57
-export PYTHON_TARBALL := Python-3.8.13.tar.xz
+export PYTHON_SHA256SUM := 
5d77e278271ba803e9909a41a4f3baca006181c93ada682a5e5fe8dc4a24c5f3
+export PYTHON_TARBALL := Python-3.8.14.tar.xz
 export QXP_SHA256SUM := 
e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
 export QXP_TARBALL := libqxp-0.0.2.tar.xz
 export RAPTOR_SHA256SUM := 
ada7f0ba54787b33485d090d3d2680533520cd4426d2f7fb4782dd4a6a1480ed
commit 7da0d6a4e4160b145a6ac2b39a8a32ebda41218e
Author:     Taichi Haradaguchi <20001...@ymail.ne.jp>
AuthorDate: Tue Sep 6 21:10:53 2022 +0900
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Thu Jul 27 15:08:27 2023 +0200

    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).
    
    Change-Id: Ie6bfb2456f96a63adbf0dbcb9c902dc56f1151ee
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139493
    Tested-by: Jenkins
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/configure.ac b/configure.ac
index 89facbe53f3a..657706fab568 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8750,7 +8750,7 @@ internal)
     SYSTEM_PYTHON=
     PYTHON_VERSION_MAJOR=3
     PYTHON_VERSION_MINOR=8
-    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.12
+    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 5a3c53338c00..8319fdb31b6d 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 := 
5bbcf5a56d85c44f3a8b058fb46862ff49cbc91834d07e295d02e6de3c216df2
 export POSTGRESQL_TARBALL := postgresql-13.10.tar.bz2
-export PYTHON_SHA256SUM := 
b1d3a76420375343b5e8a22fceb1ac65b77193e9ed27146524f0a9db058728ea
-export PYTHON_TARBALL := Python-3.8.12.tar.xz
+export PYTHON_SHA256SUM := 
6f309077012040aa39fe8f0c61db8c0fa1c45136763299d375c9e5756f09cf57
+export PYTHON_TARBALL := Python-3.8.13.tar.xz
 export QXP_SHA256SUM := 
e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
 export QXP_TARBALL := libqxp-0.0.2.tar.xz
 export RAPTOR_SHA256SUM := 
ada7f0ba54787b33485d090d3d2680533520cd4426d2f7fb4782dd4a6a1480ed
commit 1ce0b2ecbd5dfbcfe57e054a83f9ffda589075d6
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sat Jan 22 13:07:23 2022 +0000
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Thu Jul 27 14:59:46 2023 +0200

    upgrade to Python-3.8.12
    
    Change-Id: I0dd1a767c5c65e5789e690e13958ba4ad92a7e16
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128770
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/configure.ac b/configure.ac
index d9fbee6396c6..89facbe53f3a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8750,7 +8750,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}.12
     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 ef815b1dc466..5a3c53338c00 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 := 
5bbcf5a56d85c44f3a8b058fb46862ff49cbc91834d07e295d02e6de3c216df2
 export POSTGRESQL_TARBALL := postgresql-13.10.tar.bz2
-export PYTHON_SHA256SUM := 
6af24a66093dd840bcccf371d4044a3027e655cf24591ce26e48022bc79219d9
-export PYTHON_TARBALL := Python-3.8.10.tar.xz
+export PYTHON_SHA256SUM := 
b1d3a76420375343b5e8a22fceb1ac65b77193e9ed27146524f0a9db058728ea
+export PYTHON_TARBALL := Python-3.8.12.tar.xz
 export QXP_SHA256SUM := 
e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
 export QXP_TARBALL := libqxp-0.0.2.tar.xz
 export RAPTOR_SHA256SUM := 
ada7f0ba54787b33485d090d3d2680533520cd4426d2f7fb4782dd4a6a1480ed
commit d967a66d0f144eec48539067b767a2649c740d4d
Author:     Jan-Marek Glogowski <glo...@fbihome.de>
AuthorDate: Thu Jun 24 08:26:33 2021 +0200
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Thu Jul 27 13:51:46 2023 +0200

    python3: update to 3.8.10
    
    So we don't build 3.8.8rc1 anymore. I didn't look into 3.9.
    
    Change-Id: Ife7d898c913b9b164168b0ef23a055deea55815f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117757
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de>

diff --git a/configure.ac b/configure.ac
index c6572c614b5b..d9fbee6396c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8750,7 +8750,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 a5b827f44eff..ef815b1dc466 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 := 
5bbcf5a56d85c44f3a8b058fb46862ff49cbc91834d07e295d02e6de3c216df2
 export POSTGRESQL_TARBALL := postgresql-13.10.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 QXP_SHA256SUM := 
e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
 export QXP_TARBALL := libqxp-0.0.2.tar.xz
 export RAPTOR_SHA256SUM := 
ada7f0ba54787b33485d090d3d2680533520cd4426d2f7fb4782dd4a6a1480ed
commit 029a71d838266be9c676bde0718b6606bd26b0e1
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Feb 19 11:53:27 2021 +0100
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Thu Jul 27 12:19:31 2023 +0200

    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
    
    Change-Id: Idbe072a9db1faf8363b4f7795b9fde71c26969f0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111208
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/configure.ac b/configure.ac
index 87c428783856..c6572c614b5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8750,7 +8750,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 0a5bc0721d7b..a5b827f44eff 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 := 
5bbcf5a56d85c44f3a8b058fb46862ff49cbc91834d07e295d02e6de3c216df2
 export POSTGRESQL_TARBALL := postgresql-13.10.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 QXP_SHA256SUM := 
e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
 export QXP_TARBALL := libqxp-0.0.2.tar.xz
 export RAPTOR_SHA256SUM := 
ada7f0ba54787b33485d090d3d2680533520cd4426d2f7fb4782dd4a6a1480ed
commit add6cfcf3c8695bc9cdf1da4e1b45cb68c695ece
Author:     Jan-Marek Glogowski <glo...@fbihome.de>
AuthorDate: Tue Jul 14 23:35:57 2020 +0200
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Thu Jul 27 12:08:28 2023 +0200

    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.
    
    Change-Id: Ib82f7b77213da9c525f8c79a13d128d9eec9ca64
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98437
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de>

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index e6fec4edcb1b..f43f8acf2f1e 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -3207,7 +3207,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 0d0d06cb9a16..87c428783856 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8749,8 +8749,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}.7
+    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 e13acde7611b..0a5bc0721d7b 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 := 
5bbcf5a56d85c44f3a8b058fb46862ff49cbc91834d07e295d02e6de3c216df2
 export POSTGRESQL_TARBALL := postgresql-13.10.tar.bz2
-export PYTHON_SHA256SUM := 
06a0a9f1bf0d8cd1e4121194d666c4e28ddae4dd54346de6c343206599f02136
-export PYTHON_TARBALL := Python-3.7.7.tar.xz
+export PYTHON_SHA256SUM := 
5f41968a95afe9bc12192d7e6861aab31e80a46c46fa59d3d837def6a4cd4d37
+export PYTHON_TARBALL := Python-3.8.4.tar.xz
 export QXP_SHA256SUM := 
e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
 export QXP_TARBALL := libqxp-0.0.2.tar.xz
 export RAPTOR_SHA256SUM := 
ada7f0ba54787b33485d090d3d2680533520cd4426d2f7fb4782dd4a6a1480ed
diff --git a/external/libffi/ExternalPackage_libffi.mk 
b/external/libffi/ExternalPackage_libffi.mk
new file mode 100644
index 000000000000..61b0a1ca460c
--- /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)/python-core-$(PYTHON_VERSION)/lib,
 \
+    $(HOST_PLATFORM)/.libs/libffi-7.dll \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
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 60eeb022160c..bc568a810d6e 100644
--- a/external/python3/ExternalPackage_python3.mk
+++ b/external/python3/ExternalPackage_python3.mk
@@ -24,15 +24,14 @@ $(eval $(call 
gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/python$(PYT
 endif
 $(eval $(call 
gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib,\
        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)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 \
@@ -41,8 +40,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
@@ -53,71 +52,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/_uuid.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
-       
LO_lib/xxlimited.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
-       
LO_lib/_xxtestfuzz.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
-       LO_lib/zlib.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so 
\
+       
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
@@ -138,7 +134,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 
-pc,,$(HOST_PLATFORM)).py \
+       LO_lib/_sysconfigdata__$(python3_MACHDEP)_$(subst i686,i386,$(subst 
-pc,,$(HOST_PLATFORM))).py \
 ))
 endif
 
@@ -148,6 +144,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 \
@@ -160,6 +160,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 \
@@ -178,6 +179,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 \
@@ -193,7 +195,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 \
@@ -230,7 +231,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 \
@@ -258,21 +258,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 \
@@ -286,10 +285,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 \
@@ -304,10 +303,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 \
@@ -319,14 +319,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,\
@@ -381,8 +408,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 \
@@ -391,44 +418,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,\
@@ -472,8 +499,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 \
@@ -490,10 +517,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 \
@@ -527,20 +554,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 \
@@ -563,8 +590,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 \
@@ -574,19 +601,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 \
@@ -614,6 +640,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 \
 ))
@@ -650,8 +677,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 \
@@ -660,13 +687,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 \
@@ -706,8 +733,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,\
@@ -716,13 +743,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 \
@@ -731,7 +770,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 \
@@ -752,6 +792,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 \
@@ -763,40 +804,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 \
@@ -821,21 +828,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 6c958431cd97..a6338ccf3578 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)/out32dll \
                        /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 d04868b93a44..94950537386c 100644
--- a/external/python3/UnpackedTarball_python3.mk
+++ b/external/python3/UnpackedTarball_python3.mk
@@ -20,7 +20,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,python3,\
        external/python3/python-3.3.0-darwin.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 d5cb17e339a2..27a355e2ad21 100644
--- a/external/python3/python-3.3.0-darwin.patch.1
+++ b/external/python3/python-3.3.0-darwin.patch.1
@@ -49,7 +49,7 @@ diff -ru python3.orig/Mac/Resources/app/Info.plist.in 
python3/Mac/Resources/app/
 -      <string>Python</string>
 +      <string>LibreOfficePython</string>
        <key>CFBundleGetInfoString</key>
-       <string>%version%, (c) 2001-2016 Python Software Foundation.</string>
+       <string>%version%, (c) 2001-2020 Python Software Foundation.</string>
        <key>CFBundleHelpBookFolder</key>
 diff -ru python3.orig/Mac/Resources/framework/Info.plist.in 
python3/Mac/Resources/framework/Info.plist.in
 --- python3.orig/Mac/Resources/framework/Info.plist.in 2015-07-05 
18:50:07.000000000 +0200
@@ -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 09b311f3727de30b7609e413ff01d7c8a85dc7a0
Author:     Michael Stahl <michael.st...@cib.de>
AuthorDate: Thu Jan 9 15:06:07 2020 +0100
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Wed Jul 26 14:22:48 2023 +0200

    python3: bundle libffi for GNU/Linux builds
    
    CPython commit f40d4ddff3c800b3c956a5e8820aabe3aa87cddd "Closes #27979:
    Remove bundled copy of libffi" causes a bit of a problem because it
    turns out that libffi isn't all that stable; there's libffi.so.5 on
    CentOS 6, libffi.so.6 on CentOS 7 and libffi.so.7 on
    lo_daily_update_gandalf tinderbox.
    
    So we have to bundle it in LO; it's only used on GNU/Linux currently.
    
    CPython commit 32119e10b792ad7ee4e5f951a2d89ddbaf111cc5 "bpo-35947:
    Update Windows to the current version of libffi (GH-11797)" also removes
    the libffi for MSVC, so in a future python upgrade we will have to build
    libffi for MSVC too.
    
    The libffi fork for MacOSX is still in CPython git master.
    
    (regression from b10be5d48433076f0b7238d818020f708553e114)
    
    Change-Id: Ibc20cf8cd3614cf9941b6970662bd930496776b2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86493
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@cib.de>

diff --git a/Makefile.fetch b/Makefile.fetch
index 522a4e22bc72..d046a1029448 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -154,6 +154,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk 
$(SRCDIR)/download.lst $(S
                $(call fetch_Optional,LIBASSUAN,LIBASSUAN_TARBALL) \
                $(call fetch_Optional,LIBEOT,LIBEOT_TARBALL) \
                $(call fetch_Optional,LIBEXTTEXTCAT,LIBEXTTEXTCAT_TARBALL) \
+               $(call fetch_Optional,LIBFFI,LIBFFI_TARBALL) \
                $(call fetch_Optional,LIBGPGERROR,LIBGPGERROR_TARBALL) \
                $(call fetch_Optional,LIBLANGTAG,LANGTAGREG_TARBALL) \
                $(call fetch_Optional,LIBLANGTAG,LIBLANGTAG_TARBALL) \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 82da26bfe624..e6fec4edcb1b 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -3213,6 +3213,12 @@ endif
 
 endef
 
+# this is only used by python currently
+define gb_ExternalProject__use_libffi
+$(call gb_ExternalProject_use_external_project,$(1),libffi)
+
+endef
+
 endif # SYSTEM_PYTHON
 
 # ORCUS
diff --git a/bin/check-elf-dynamic-objects b/bin/check-elf-dynamic-objects
index ac73ce0b626c..24175f66d40c 100755
--- a/bin/check-elf-dynamic-objects
+++ b/bin/check-elf-dynamic-objects
@@ -113,9 +113,6 @@ local file="$1"
             # skip the majority of files, no ELF binaries here
             skip=1
         ;;
-        */_ctypes.cpython-*.so)
-            whitelist="${whitelist} libffi.so.6" # TODO dubious?
-        ;;
         */_uuid.cpython-*.so)
             whitelist="${whitelist} libuuid.so.1"
         ;;
diff --git a/configure.ac b/configure.ac
index 347d1ecd3bd4..0d0d06cb9a16 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8756,6 +8756,9 @@ internal)
     fi
     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
     BUILD_TYPE="$BUILD_TYPE PYTHON"
+    if test "$OS" = LINUX; then
+        BUILD_TYPE="$BUILD_TYPE LIBFFI"
+    fi
     # Embedded Python dies without Home set
     if test "$HOME" = ""; then
         export HOME=""
diff --git a/download.lst b/download.lst
index f032941715bb..e13acde7611b 100644
--- a/download.lst
+++ b/download.lst
@@ -146,6 +146,8 @@ export LIBEOT_SHA256SUM := 
cf5091fa8e7dcdbe667335eb90a2cfdd0a3fe8f8c7c8d1ece44d9
 export LIBEOT_TARBALL := libeot-0.01.tar.bz2
 export LIBEXTTEXTCAT_SHA256SUM := 
13fdbc9d4c489a4d0519e51933a1aa21fe3fb9eb7da191b87f7a63e82797dac8
 export LIBEXTTEXTCAT_TARBALL := libexttextcat-3.4.5.tar.xz
+export LIBFFI_SHA256SUM := 
72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056
+export LIBFFI_TARBALL := libffi-3.3.tar.gz
 export LIBGPGERROR_SHA256SUM := 
4f93aac6fecb7da2b92871bb9ee33032be6a87b174f54abf8ddf0911a22d29d2
 export LIBGPGERROR_TARBALL := libgpg-error-1.27.tar.bz2
 export LIBLANGTAG_SHA256SUM := 
d6242790324f1432fb0a6fae71b6851f520b2c5a87675497cf8ea14c2924d52e
diff --git a/external/Module_external.mk b/external/Module_external.mk
index e9d53ee5ab7c..b03083640336 100644
--- a/external/Module_external.mk
+++ b/external/Module_external.mk
@@ -57,6 +57,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\
        $(call gb_Helper_optional,LIBATOMIC_OPS,libatomic_ops) \
        $(call gb_Helper_optional,LIBEOT,libeot) \
        $(call gb_Helper_optional,LIBEXTTEXTCAT,libexttextcat) \
+       $(call gb_Helper_optional,LIBFFI,libffi) \
        $(call gb_Helper_optional,LIBGPGERROR,libgpg-error) \
        $(call gb_Helper_optional,LIBLANGTAG,liblangtag) \
        $(call gb_Helper_optional,LIBNUMBERTEXT,libnumbertext) \
diff --git a/external/libffi/ExternalProject_libffi.mk 
b/external/libffi/ExternalProject_libffi.mk
new file mode 100644
index 000000000000..bdf8fe61eb76
--- /dev/null
+++ b/external/libffi/ExternalProject_libffi.mk
@@ -0,0 +1,33 @@
+# -*- 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_ExternalProject_ExternalProject,libffi))
+
+$(eval $(call gb_ExternalProject_register_targets,libffi,\
+       build \
+))
+
+# set prefix so that it ends up in libffi.pc so that pkg-config in python3 
works
+
+$(call gb_ExternalProject_get_state_target,libffi,build):
+       $(call gb_ExternalProject_run,build,\
+               ./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)" \
+                       --prefix=$(call 
gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM) \
+                       --disable-docs \
+               && $(MAKE) \
+       )
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libffi/Makefile b/external/libffi/Makefile
new file mode 100644
index 000000000000..e4968cf85fb6
--- /dev/null
+++ b/external/libffi/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libffi/Module_libffi.mk b/external/libffi/Module_libffi.mk
new file mode 100644
index 000000000000..739fd4197000
--- /dev/null
+++ b/external/libffi/Module_libffi.mk
@@ -0,0 +1,17 @@
+# -*- 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_Module_Module,libffi))
+
+$(eval $(call gb_Module_add_targets,libffi,\
+       UnpackedTarball_libffi \
+       ExternalProject_libffi \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libffi/README b/external/libffi/README
new file mode 100644
index 000000000000..cdf7fa937bc8
--- /dev/null
+++ b/external/libffi/README
@@ -0,0 +1,3 @@
+libffi is required to build CPython's ctypes module
+
+https://sourceware.org/libffi/
diff --git a/external/libffi/UnpackedTarball_libffi.mk 
b/external/libffi/UnpackedTarball_libffi.mk
new file mode 100644
index 000000000000..5d0582329ac5
--- /dev/null
+++ b/external/libffi/UnpackedTarball_libffi.mk
@@ -0,0 +1,14 @@
+# -*- 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_UnpackedTarball_UnpackedTarball,libffi))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,libffi,$(LIBFFI_TARBALL)))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/python3/ExternalProject_python3.mk 
b/external/python3/ExternalProject_python3.mk
index 5350f9e4c5d9..6c958431cd97 100644
--- a/external/python3/ExternalProject_python3.mk
+++ b/external/python3/ExternalProject_python3.mk
@@ -11,6 +11,7 @@ $(eval $(call gb_ExternalProject_ExternalProject,python3))
 
 $(eval $(call gb_ExternalProject_use_externals,python3,\
        expat \
+       $(if $(filter LINUX,$(OS)),libffi) \
        openssl \
        zlib \
 ))
@@ -52,8 +53,12 @@ else
 # OPENSSL_INCLUDES OPENSSL_LDFLAGS OPENSSL_LIBS cannot be set via commandline!
 # use --with-openssl instead, which requires include/ and lib/ subdirs.
 
-# TODO: libffi has different SONAME on CentOS 6 vs. 7, so we better use
-# --without-system-ffi. However, that doesn't actually do anything on Linux :(
+# libffi is not all that stable, with 3 different SONAMEs currently, so we
+# have to bundle it; --without-system-ffi does not work any more on Linux.
+# Unfortuantely (as of 3.7) pkg-config is used to locate libffi so we do some
+# hacks to find the libffi.pc in workdir by overriding PKG_CONFIG_LIBDIR.
+# Also, pkg-config is only used to find the headers, the libdir needs to be
+# passed extra.
 
 # create a symlink "LO_lib" because the .so are in a directory with platform
 # specific name like build/lib.linux-x86_64-3.3
@@ -91,6 +96,9 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
                $(if $(SYSTEM_OPENSSL)$(DISABLE_OPENSSL),,\
                        --with-openssl=$(call 
gb_UnpackedTarball_get_dir,openssl) \
                ) \
+               $(if $(filter LINUX,$(OS)), \
+                       PKG_CONFIG_LIBDIR="$(call 
gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM)$${PKG_CONFIG_LIBDIR:+:$$PKG_CONFIG_LIBDIR}"
 \
+               ) \
                CC="$(strip $(CC) \
                        $(if $(SYSTEM_EXPAT),,-I$(call 
gb_UnpackedTarball_get_dir,expat)/lib) \
                        $(if $(SYSBASE), -I$(SYSBASE)/usr/include) \
@@ -98,6 +106,7 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
                $(if $(python3_cflags),CFLAGS='$(python3_cflags)') \
                $(if $(filter -fsanitize=%,$(CC)),LINKCC="$(CXX) -pthread") \
                LDFLAGS="$(strip $(LDFLAGS) \
+                       $(if $(filter LINUX,$(OS)),-L$(call 
gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM)/.libs) \
                        $(if $(SYSTEM_EXPAT),,-L$(gb_StaticLibrary_WORKDIR)) \
                        $(if $(SYSTEM_ZLIB),,-L$(gb_StaticLibrary_WORKDIR)) \
                        $(if $(SYSBASE), -L$(SYSBASE)/usr/lib) \
diff --git a/readlicense_oo/license/license.xml 
b/readlicense_oo/license/license.xml
index d211b18b1692..1c2a3d4b6290 100644
--- a/readlicense_oo/license/license.xml
+++ b/readlicense_oo/license/license.xml
@@ -1686,6 +1686,29 @@
         ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO 
OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
         UPDATES, ENHANCEMENTS, OR MODIFICATIONS.</p>
     </div>
+    <div class ="LIBFFI">
+        <h2>libffi</h2>
+        <p>The following software may be included in this product: libffi</p>
+        <p>The libffi project code is covered by the MIT license:</p>
+        <p>libffi - Copyright (c) 1996-2019  Anthony Green, Red Hat, Inc and 
others.</p>
+        <p>See source files for details.</p>
+        <p>Permission is hereby granted, free of charge, to any person 
obtaining
+        a copy of this software and associated documentation files (the
+        ``Software''), to deal in the Software without restriction, including
+        without limitation the rights to use, copy, modify, merge, publish,
+        distribute, sublicense, and/or sell copies of the Software, and to
+        permit persons to whom the Software is furnished to do so, subject to
+        the following conditions:</p>
+        <p>The above copyright notice and this permission notice shall be
+        included in all copies or substantial portions of the Software.</p>
+        <p>THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+        IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+        CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+        TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+        SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
+    </div>
     <div class="PYTHON">
         <h2>Python</h2>
         <p>The following software may be included in this product: Python. Use 
of any of this software is governed by
commit 22d73a56e1e55a27e7029d19cb47a84064736c69
Author:     Michael Stahl <michael.st...@cib.de>
AuthorDate: Mon Mar 23 14:30:26 2020 +0100
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Wed Jul 26 13:50:42 2023 +0200

    python3: upgrade to release 3.7.7
    
    Fixes CVE-2020-8315; this only affects Windows 7 and is a regression in
    Python 3.6.
    
    Change-Id: Ic1706e064a1b03ca1de6361794ed4586a89821d9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90916
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@cib.de>

diff --git a/configure.ac b/configure.ac
index 2b5f0e017560..347d1ecd3bd4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8750,7 +8750,7 @@ internal)
     SYSTEM_PYTHON=
     PYTHON_VERSION_MAJOR=3
     PYTHON_VERSION_MINOR=7
-    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.6
+    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
     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 448e0fe8b229..f032941715bb 100644
--- a/download.lst
+++ b/download.lst
@@ -210,8 +210,8 @@ export POPPLER_SHA256SUM := 
d7a8f748211359cadb774ba3e18ecda6464b34027045c0648eb3
 export POPPLER_TARBALL := poppler-22.09.0.tar.xz
 export POSTGRESQL_SHA256SUM := 
5bbcf5a56d85c44f3a8b058fb46862ff49cbc91834d07e295d02e6de3c216df2
 export POSTGRESQL_TARBALL := postgresql-13.10.tar.bz2
-export PYTHON_SHA256SUM := 
55a2cce72049f0794e9a11a84862e9039af9183603b78bc60d89539f82cf533f
-export PYTHON_TARBALL := Python-3.7.6.tar.xz
+export PYTHON_SHA256SUM := 
06a0a9f1bf0d8cd1e4121194d666c4e28ddae4dd54346de6c343206599f02136
+export PYTHON_TARBALL := Python-3.7.7.tar.xz
 export QXP_SHA256SUM := 
e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
 export QXP_TARBALL := libqxp-0.0.2.tar.xz
 export RAPTOR_SHA256SUM := 
ada7f0ba54787b33485d090d3d2680533520cd4426d2f7fb4782dd4a6a1480ed
commit 60e56bd38c667e0a80c548703c2342f60e88024f
Author:     Michael Stahl <michael.st...@cib.de>
AuthorDate: Mon Dec 9 14:08:19 2019 +0100
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Wed Jul 26 13:10:23 2023 +0200

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

diff --git a/bin/check-elf-dynamic-objects b/bin/check-elf-dynamic-objects
index 3667f5c09a83..ac73ce0b626c 100755
--- a/bin/check-elf-dynamic-objects
+++ b/bin/check-elf-dynamic-objects
@@ -113,6 +113,12 @@ local file="$1"
             # skip the majority of files, no ELF binaries here
             skip=1
         ;;
+        */_ctypes.cpython-*.so)
+            whitelist="${whitelist} libffi.so.6" # TODO dubious?
+        ;;
+        */_uuid.cpython-*.so)
+            whitelist="${whitelist} libuuid.so.1"
+        ;;
         */libcairocanvaslo.so)
             whitelist="${whitelist} libcairo.so.2"
         ;;
diff --git a/configure.ac b/configure.ac
index 55deac533ecb..2b5f0e017560 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8749,8 +8749,8 @@ int main(int argc, char **argv) {
 internal)
     SYSTEM_PYTHON=
     PYTHON_VERSION_MAJOR=3
-    PYTHON_VERSION_MINOR=5
-    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.9
+    PYTHON_VERSION_MINOR=7
+    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.6
     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in 
download.lst])
     fi
diff --git a/download.lst b/download.lst
index 398dc963b330..448e0fe8b229 100644
--- a/download.lst
+++ b/download.lst
@@ -210,8 +210,8 @@ export POPPLER_SHA256SUM := 
d7a8f748211359cadb774ba3e18ecda6464b34027045c0648eb3
 export POPPLER_TARBALL := poppler-22.09.0.tar.xz
 export POSTGRESQL_SHA256SUM := 
5bbcf5a56d85c44f3a8b058fb46862ff49cbc91834d07e295d02e6de3c216df2
 export POSTGRESQL_TARBALL := postgresql-13.10.tar.bz2
-export PYTHON_SHA256SUM := 
c24a37c63a67f53bdd09c5f287b5cff8e8b98f857bf348c577d454d3f74db049
-export PYTHON_TARBALL := Python-3.5.9.tar.xz
+export PYTHON_SHA256SUM := 
55a2cce72049f0794e9a11a84862e9039af9183603b78bc60d89539f82cf533f
+export PYTHON_TARBALL := Python-3.7.6.tar.xz
 export QXP_SHA256SUM := 
e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
 export QXP_TARBALL := libqxp-0.0.2.tar.xz
 export RAPTOR_SHA256SUM := 
ada7f0ba54787b33485d090d3d2680533520cd4426d2f7fb4782dd4a6a1480ed
diff --git a/external/openssl/ExternalProject_openssl.mk 
b/external/openssl/ExternalProject_openssl.mk
index 17fd4c68da54..eccf8438958a 100644
--- a/external/openssl/ExternalProject_openssl.mk
+++ b/external/openssl/ExternalProject_openssl.mk
@@ -83,7 +83,9 @@ $(call gb_ExternalProject_get_state_target,openssl,build):
                        CC="$(CC) -fPIC \
                                $(if $(filter TRUE, $(ENABLE_DBGUTIL)), 
-DPURIFY,) \
                                $(if $(filter-out WNT 
MACOSX,$(OS)),-fvisibility=hidden)" \
+               && ln -s . lib \
        )
+# symlink lib dir for python3
 endif
 
 # vim: set noet sw=4 ts=4:
diff --git 
a/external/python3/0001-3.6-bpo-17239-Disable-external-entities-in-SAX-parse.patch.1
 
b/external/python3/0001-3.6-bpo-17239-Disable-external-entities-in-SAX-parse.patch.1
deleted file mode 100644
index 489e5d0e89ee..000000000000
--- 
a/external/python3/0001-3.6-bpo-17239-Disable-external-entities-in-SAX-parse.patch.1
+++ /dev/null
@@ -1,59 +0,0 @@
-From 582d188e6e3487180891f1fc457a80dec8be26a8 Mon Sep 17 00:00:00 2001
-From: Christian Heimes <christ...@python.org>
-Date: Mon, 24 Sep 2018 14:38:31 +0200
-Subject: [PATCH] [3.6] bpo-17239: Disable external entities in SAX parser
- (GH-9217) (GH-9512)
-
-The SAX parser no longer processes general external entities by default
-to increase security. Before, the parser created network connections
-to fetch remote files or loaded local files from the file system for DTD
-and entities.
-
-Signed-off-by: Christian Heimes <christ...@python.org>
-
-https://bugs.python.org/issue17239.
-(cherry picked from commit 17b1d5d4e36aa57a9b25a0e694affbd1ee637e45)
-
-Co-authored-by: Christian Heimes <christ...@python.org>
-
-
-
-https://bugs.python.org/issue17239
----
- Doc/library/xml.dom.pulldom.rst               | 14 +++++
- Doc/library/xml.rst                           |  6 +-
- Doc/library/xml.sax.rst                       |  8 +++
- Doc/whatsnew/3.6.rst                          | 18 +++++-
- Lib/test/test_pulldom.py                      |  7 +++
- Lib/test/test_sax.py                          | 60 ++++++++++++++++++-
- Lib/test/test_xml_etree.py                    | 13 ++++
- Lib/xml/sax/expatreader.py                    |  2 +-
- .../2018-09-11-18-30-55.bpo-17239.kOpwK2.rst  |  3 +
- 9 files changed, 125 insertions(+), 6 deletions(-)
- create mode 100644 
Misc/NEWS.d/next/Security/2018-09-11-18-30-55.bpo-17239.kOpwK2.rst
-
-diff --git a/Lib/xml/sax/expatreader.py b/Lib/xml/sax/expatreader.py
-index 421358fa5b..5066ffc2fa 100644
---- a/Lib/xml/sax/expatreader.py
-+++ b/Lib/xml/sax/expatreader.py
-@@ -95,7 +95,7 @@ class ExpatParser(xmlreader.IncrementalParser, 
xmlreader.Locator):
-         self._lex_handler_prop = None
-         self._parsing = 0
-         self._entity_stack = []
--        self._external_ges = 1
-+        self._external_ges = 0
-         self._interning = None
- 
-     # XMLReader methods
-diff --git 
a/Misc/NEWS.d/next/Security/2018-09-11-18-30-55.bpo-17239.kOpwK2.rst 
b/Misc/NEWS.d/next/Security/2018-09-11-18-30-55.bpo-17239.kOpwK2.rst
-new file mode 100644
-index 0000000000..8dd0fe8c1b
---- /dev/null
-+++ b/Misc/NEWS.d/next/Security/2018-09-11-18-30-55.bpo-17239.kOpwK2.rst
-@@ -0,0 +1,3 @@
-+The xml.sax and xml.dom.minidom parsers no longer processes external
-+entities by default. External DTD and ENTITY declarations no longer
-+load files or create network connections.
--- 
-2.20.1
-
diff --git 
a/external/python3/0001-3.6-closes-bpo-42938-Replace-snprintf-with-Python-un.patch.1
 
b/external/python3/0001-3.6-closes-bpo-42938-Replace-snprintf-with-Python-un.patch.1
deleted file mode 100644
index fdcc5cb65267..000000000000
--- 
a/external/python3/0001-3.6-closes-bpo-42938-Replace-snprintf-with-Python-un.patch.1
+++ /dev/null
@@ -1,175 +0,0 @@
-From 34df10a9a16b38d54421eeeaf73ec89828563be7 Mon Sep 17 00:00:00 2001
-From: Benjamin Peterson <benja...@python.org>
-Date: Mon, 18 Jan 2021 15:11:46 -0600
-Subject: [PATCH] [3.6] closes bpo-42938: Replace snprintf with Python unicode
- formatting in ctypes param reprs. (GH-24250)
-
-(cherry picked from commit 916610ef90a0d0761f08747f7b0905541f0977c7)
-
-Co-authored-by: Benjamin Peterson <benja...@python.org>
----
- Lib/ctypes/test/test_parameters.py            | 43 +++++++++++++++
- .../2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst  |  2 +
- Modules/_ctypes/callproc.c                    | 55 +++++++------------
- 3 files changed, 66 insertions(+), 34 deletions(-)
- create mode 100644 
Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst
-
-diff --git a/Lib/ctypes/test/test_parameters.py 
b/Lib/ctypes/test/test_parameters.py
-index e4c25fd880..531894fdec 100644
---- a/Lib/ctypes/test/test_parameters.py
-+++ b/Lib/ctypes/test/test_parameters.py
-@@ -201,6 +201,49 @@ def __dict__(self):
-         self.assertRaises(ArgumentError, func, 99)
- 
- 
-+    def test_parameter_repr(self):
-+        from ctypes import (
-+            c_bool,
-+            c_char,
-+            c_wchar,
-+            c_byte,
-+            c_ubyte,
-+            c_short,
-+            c_ushort,
-+            c_int,
-+            c_uint,
-+            c_long,
-+            c_ulong,
-+            c_longlong,
-+            c_ulonglong,
-+            c_float,
-+            c_double,
-+            c_longdouble,
-+            c_char_p,
-+            c_wchar_p,
-+            c_void_p,
-+        )
-+        self.assertRegex(repr(c_bool.from_param(True)), r"^<cparam '\?' at 
0x[A-Fa-f0-9]+>$")
-+        self.assertEqual(repr(c_char.from_param(97)), "<cparam 'c' ('a')>")
-+        self.assertRegex(repr(c_wchar.from_param('a')), r"^<cparam 'u' at 
0x[A-Fa-f0-9]+>$")
-+        self.assertEqual(repr(c_byte.from_param(98)), "<cparam 'b' (98)>")
-+        self.assertEqual(repr(c_ubyte.from_param(98)), "<cparam 'B' (98)>")
-+        self.assertEqual(repr(c_short.from_param(511)), "<cparam 'h' (511)>")
-+        self.assertEqual(repr(c_ushort.from_param(511)), "<cparam 'H' (511)>")
-+        self.assertRegex(repr(c_int.from_param(20000)), r"^<cparam '[li]' 
\(20000\)>$")
-+        self.assertRegex(repr(c_uint.from_param(20000)), r"^<cparam '[LI]' 
\(20000\)>$")
-+        self.assertRegex(repr(c_long.from_param(20000)), r"^<cparam '[li]' 
\(20000\)>$")
-+        self.assertRegex(repr(c_ulong.from_param(20000)), r"^<cparam '[LI]' 
\(20000\)>$")
-+        self.assertRegex(repr(c_longlong.from_param(20000)), r"^<cparam 
'[liq]' \(20000\)>$")
-+        self.assertRegex(repr(c_ulonglong.from_param(20000)), r"^<cparam 
'[LIQ]' \(20000\)>$")
-+        self.assertEqual(repr(c_float.from_param(1.5)), "<cparam 'f' (1.5)>")
-+        self.assertEqual(repr(c_double.from_param(1.5)), "<cparam 'd' (1.5)>")
-+        self.assertEqual(repr(c_double.from_param(1e300)), "<cparam 'd' 
(1e+300)>")
-+        self.assertRegex(repr(c_longdouble.from_param(1.5)), r"^<cparam ('d' 
\(1.5\)|'g' at 0x[A-Fa-f0-9]+)>$")
-+        self.assertRegex(repr(c_char_p.from_param(b'hihi')), "^<cparam 'z' 
\(0x[A-Fa-f0-9]+\)>$")
-+        self.assertRegex(repr(c_wchar_p.from_param('hihi')), "^<cparam 'Z' 
\(0x[A-Fa-f0-9]+\)>$")
-+        self.assertRegex(repr(c_void_p.from_param(0x12)), r"^<cparam 'P' 
\(0x0*12\)>$")
-+
- ################################################################
- 
- if __name__ == '__main__':
-diff --git 
a/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst 
b/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst
-new file mode 100644
-index 0000000000..7df65a156f
---- /dev/null
-+++ b/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst
-@@ -0,0 +1,2 @@
-+Avoid static buffers when computing the repr of :class:`ctypes.c_double` and
-+:class:`ctypes.c_longdouble` values.

... etc. - the rest is truncated

Reply via email to