summaryrefslogtreecommitdiffstats
path: root/external/python3
diff options
context:
space:
mode:
Diffstat (limited to 'external/python3')
-rw-r--r--external/python3/0001-3.6-bpo-17239-Disable-external-entities-in-SAX-parse.patch.159
-rw-r--r--external/python3/ExternalPackage_python3.mk32
-rw-r--r--external/python3/ExternalProject_python3.mk16
-rw-r--r--external/python3/UnpackedTarball_python3.mk12
-rw-r--r--external/python3/darwin.patch.012
-rw-r--r--external/python3/i100492-freebsd.patch.16
-rw-r--r--external/python3/init-sys-streams-cant-initialize-stdin.patch.043
-rw-r--r--external/python3/internal-zlib.patch.08
-rw-r--r--external/python3/macos-11.patch.06
-rw-r--r--external/python3/python-3.3.0-darwin.patch.16
-rw-r--r--external/python3/python-3.3.3-disable-obmalloc.patch.04
-rw-r--r--external/python3/python-3.3.3-elf-rpath.patch.14
-rw-r--r--external/python3/python-3.5.4-msvc-disable.patch.117
-rw-r--r--external/python3/python-3.5.tweak.strip.soabi.patch2
-rw-r--r--external/python3/python-3.7.6-msvc-ssl.patch.18
-rw-r--r--external/python3/python-3.8-msvc-libffi.patch.116
-rw-r--r--external/python3/tsan.patch.010
-rw-r--r--external/python3/ubsan.patch.04
18 files changed, 147 insertions, 118 deletions
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 <christian@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 <christian@python.org>
-
-https://bugs.python.org/issue17239.
-(cherry picked from commit 17b1d5d4e36aa57a9b25a0e694affbd1ee637e45)
-
-Co-authored-by: Christian Heimes <christian@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/ExternalPackage_python3.mk b/external/python3/ExternalPackage_python3.mk
index faddf06fc36a..907b0b530c46 100644
--- a/external/python3/ExternalPackage_python3.mk
+++ b/external/python3/ExternalPackage_python3.mk
@@ -25,8 +25,9 @@ $(eval $(call gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/python$(PYT
ifeq ($(MSVC_USE_DEBUG_RUNTIME),)
$(eval $(call gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/python$(PYTHON_VERSION_MAJOR).dll,PCbuild/$(python_arch_subdir)python$(PYTHON_VERSION_MAJOR).dll))
endif
-$(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib,\
+python3_EXTENSION_MODULES= \
PCbuild/$(python_arch_subdir)_asyncio$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+ PCbuild/$(python_arch_subdir)_bz2$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
PCbuild/$(python_arch_subdir)_ctypes$(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 \
@@ -40,29 +41,32 @@ $(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-cor
PCbuild/$(python_arch_subdir)select$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
PCbuild/$(python_arch_subdir)unicodedata$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
PCbuild/$(python_arch_subdir)winsound$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+
+$(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib,\
+ $(python3_EXTENSION_MODULES) \
))
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).$(PYTHON_VERSION_MINOR)$(if $(ENABLE_DBGUTIL),d).so,libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)$(if $(ENABLE_DBGUTIL),d).so))
$(eval $(call gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)$(if $(ENABLE_DBGUTIL),d).so.1.0,libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)$(if $(ENABLE_DBGUTIL),d).so))
-$(eval $(call gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/python.bin-gdb.py,Tools/gdb/libpython.py))
+$(eval $(call gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)$(if $(ENABLE_DBGUTIL),d).so.1.0-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
-# build successfully without stopping; so the build will break on delivering if
-# one of these failed to build.
+# build successfully without stopping; that's why ExternalProject_python3 explicitly checks for the
+# existence of all the files on the python3_EXTENSION_MODULES list at the end of the build.
# Obviously this list should not contain stuff with external dependencies
# that may not be available on baseline systems.
-ifneq ($(OS),AIX)
python3_EXTENSION_MODULE_SUFFIX=cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)$(if $(ENABLE_DBGUTIL),d)
-$(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/lib-dynload,\
+python3_EXTENSION_MODULES= \
LO_lib/array.$(python3_EXTENSION_MODULE_SUFFIX).so \
LO_lib/_asyncio.$(python3_EXTENSION_MODULE_SUFFIX).so \
LO_lib/audioop.$(python3_EXTENSION_MODULE_SUFFIX).so \
LO_lib/binascii.$(python3_EXTENSION_MODULE_SUFFIX).so \
LO_lib/_bisect.$(python3_EXTENSION_MODULE_SUFFIX).so \
LO_lib/_blake2.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_bz2.$(python3_EXTENSION_MODULE_SUFFIX).so \
LO_lib/cmath.$(python3_EXTENSION_MODULE_SUFFIX).so \
LO_lib/_codecs_cn.$(python3_EXTENSION_MODULE_SUFFIX).so \
LO_lib/_codecs_hk.$(python3_EXTENSION_MODULE_SUFFIX).so \
@@ -121,9 +125,11 @@ $(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-cor
LO_lib/_xxsubinterpreters.$(python3_EXTENSION_MODULE_SUFFIX).so \
LO_lib/_xxtestfuzz.$(python3_EXTENSION_MODULE_SUFFIX).so \
LO_lib/zlib.$(python3_EXTENSION_MODULE_SUFFIX).so \
+
+$(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/lib-dynload,\
+ $(python3_EXTENSION_MODULES) \
))
endif
-endif
# headers are not delivered, but used from unpacked dir Include/
# (+ toplevel for pyconfig.h)
@@ -137,6 +143,16 @@ endif
endif
# that one is generated...
+ifeq ($(HOST_PLATFORM),powerpc64le-unknown-linux-gnu)
+$(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib,\
+ LO_lib/_sysconfigdata_$(if $(ENABLE_DBGUTIL),d)_linux_powerpc64le-linux-gnu.py \
+))
+else
+ifeq ($(HOST_PLATFORM),aarch64-unknown-linux-gnu)
+$(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib,\
+ LO_lib/_sysconfigdata_$(if $(ENABLE_DBGUTIL),d)_linux_aarch64-linux-gnu.py \
+))
+else
# note: python configure overrides config.guess with something that doesn't
# put -pc in its linux platform triplets, so filter that...
ifneq ($(OS),WNT)
@@ -150,6 +166,8 @@ $(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-cor
))
endif
endif
+endif
+endif
# packages not shipped:
diff --git a/external/python3/ExternalProject_python3.mk b/external/python3/ExternalProject_python3.mk
index 3d287a7fde73..0f95cc36563c 100644
--- a/external/python3/ExternalProject_python3.mk
+++ b/external/python3/ExternalProject_python3.mk
@@ -10,6 +10,7 @@
$(eval $(call gb_ExternalProject_ExternalProject,python3))
$(eval $(call gb_ExternalProject_use_externals,python3,\
+ bzip2 \
expat \
$(if $(filter WNT LINUX,$(OS)),libffi) \
openssl \
@@ -36,6 +37,7 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
$(call gb_Trace_StartRange,python3,EXTERNAL)
$(call gb_ExternalProject_run,build,\
MAKEFLAGS= MSBuild.exe pcbuild.sln /t:Build $(gb_MSBUILD_CONFIG_AND_PLATFORM) \
+ /p:bz2Dir=$(call gb_UnpackedTarball_get_dir,bzip2) \
/p:opensslIncludeDir=$(call gb_UnpackedTarball_get_dir,openssl)/include \
/p:opensslOutDir=$(call gb_UnpackedTarball_get_dir,openssl) \
/p:zlibDir=$(call gb_UnpackedTarball_get_dir,zlib) \
@@ -44,6 +46,8 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
/maxcpucount \
/p:PlatformToolset=$(VCTOOLSET) /p:VisualStudioVersion=$(VCVER) /ToolsVersion:Current \
$(if $(filter 10,$(WINDOWS_SDK_VERSION)),/p:WindowsTargetPlatformVersion=$(UCRTVERSION)) \
+ $(foreach i,$(python3_EXTENSION_MODULES), \
+ && { test -e ../$i || { printf 'Error: missing %s\n' $i; false; } }) \
,PCBuild)
$(call gb_Trace_EndRange,python3,EXTERNAL)
@@ -56,7 +60,7 @@ else
# 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
+# Unfortunately (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.
@@ -85,20 +89,17 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
) \
) \
$(gb_RUN_CONFIGURE) ./configure \
- $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
+ $(gb_CONFIGURE_PLATFORMS) \
$(if $(ENABLE_VALGRIND),--with-valgrind) \
$(if $(ENABLE_DBGUTIL),--with-pydebug) \
--prefix=/python-inst \
--with-system-expat \
- $(if $(filter AIX,$(OS)), \
- --disable-ipv6 --with-threads OPT="-g0 -fwrapv -O3 -Wall") \
$(if $(filter MACOSX,$(OS)), \
$(if $(filter INTEL,$(CPUNAME)),--enable-universalsdk=$(MACOSX_SDK_PATH) \
--with-universal-archs=intel \
) \
--enable-framework=/@__________________________________________________OOO --with-framework-name=LibreOfficePython, \
--enable-shared \
- $(if $(filter 1090 101000 101100 101200,$(MAC_OS_X_VERSION_MIN_REQUIRED)),ac_cv_func_utimensat=no) \
) \
$(if $(ENABLE_OPENSSL),$(if $(SYSTEM_OPENSSL),,\
--with-openssl=$(call gb_UnpackedTarball_get_dir,openssl) \
@@ -107,6 +108,8 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
PKG_CONFIG_LIBDIR="$(call gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM)$${PKG_CONFIG_LIBDIR:+:$$PKG_CONFIG_LIBDIR}" \
) \
CC="$(strip $(CC) \
+ $(if $(filter -fsanitize=undefined,$(CC)),-fno-sanitize=function) \
+ $(if $(SYSTEM_BZIP2),,-I$(call gb_UnpackedTarball_get_dir,bzip2)) \
$(if $(SYSTEM_EXPAT),,-I$(call gb_UnpackedTarball_get_dir,expat)/lib) \
$(if $(SYSBASE), -I$(SYSBASE)/usr/include) \
)" \
@@ -114,6 +117,7 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
$(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_BZIP2),,-L$(call gb_UnpackedTarball_get_dir,bzip2)) \
$(if $(SYSTEM_EXPAT),,-L$(gb_StaticLibrary_WORKDIR)) \
$(if $(SYSTEM_ZLIB),,-L$(gb_StaticLibrary_WORKDIR)) \
$(if $(SYSBASE), -L$(SYSBASE)/usr/lib) \
@@ -123,6 +127,8 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
$(if $(filter MACOSX,$(OS)),DESTDIR=$(EXTERNAL_WORKDIR)/python-inst install) \
$(if $(SYSTEM_ZLIB),,ZLIB_INCDIR=$(WORKDIR)/UnpackedTarball/zlib) \
&& ln -s build/lib.* LO_lib \
+ $(foreach i,$(python3_EXTENSION_MODULES), \
+ && { test -e $i || { printf 'Error: missing %s\n' $i; false; } }) \
)
$(call gb_Trace_EndRange,python3,EXTERNAL)
diff --git a/external/python3/UnpackedTarball_python3.mk b/external/python3/UnpackedTarball_python3.mk
index 31b6a166e6ae..cbb85e14e405 100644
--- a/external/python3/UnpackedTarball_python3.mk
+++ b/external/python3/UnpackedTarball_python3.mk
@@ -12,22 +12,28 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,python3))
$(eval $(call gb_UnpackedTarball_set_tarball,python3,$(PYTHON_TARBALL),,python3))
$(eval $(call gb_UnpackedTarball_fix_end_of_line,python3,\
+ PCbuild/libffi.props \
PCbuild/pcbuild.sln \
))
-# For the configure part of external/python3/darwin.patch.0, see
-# <https://bugs.python.org/issue44065> "'configure: error: internal configure error for the platform
-# triplet' on macOS with Clang supporting --print-multiarch:"
+ifneq ($(MSYSTEM),)
+# use binary flag so patch from git-bash won't choke on mixed line-endings in patches
+$(eval $(call gb_UnpackedTarball_set_patchflags,python3,--binary))
+endif
+
$(eval $(call gb_UnpackedTarball_add_patches,python3,\
external/python3/i100492-freebsd.patch.1 \
external/python3/python-3.3.0-darwin.patch.1 \
external/python3/python-3.8-msvc-sdk.patch.1 \
+ external/python3/python-3.8-msvc-libffi.patch.1 \
external/python3/python-3.7.6-msvc-ssl.patch.1 \
external/python3/python-3.5.4-msvc-disable.patch.1 \
external/python3/ubsan.patch.0 \
external/python3/python-3.5.tweak.strip.soabi.patch \
external/python3/darwin.patch.0 \
external/python3/macos-11.patch.0 \
+ external/python3/tsan.patch.0 \
+ external/python3/init-sys-streams-cant-initialize-stdin.patch.0 \
))
ifneq ($(filter DRAGONFLY FREEBSD LINUX NETBSD OPENBSD SOLARIS,$(OS)),)
diff --git a/external/python3/darwin.patch.0 b/external/python3/darwin.patch.0
index 30d20ed57578..139cdc9780bb 100644
--- a/external/python3/darwin.patch.0
+++ b/external/python3/darwin.patch.0
@@ -8,15 +8,3 @@
.text
/* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags,
---- configure
-+++ configure
-@@ -5167,7 +5167,9 @@
- fi
-
-
-+if test "$(uname -s)" = Darwin; then MULTIARCH=; else
- MULTIARCH=$($CC --print-multiarch 2>/dev/null)
-+fi
-
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the platform triplet based on compiler characteristics" >&5
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 maho@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 maho@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 maho@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/init-sys-streams-cant-initialize-stdin.patch.0 b/external/python3/init-sys-streams-cant-initialize-stdin.patch.0
new file mode 100644
index 000000000000..61b2464ab4b8
--- /dev/null
+++ b/external/python3/init-sys-streams-cant-initialize-stdin.patch.0
@@ -0,0 +1,43 @@
+--- Python/pylifecycle.c 2024-03-27 14:34:43.905367358 +0000
++++ Python/pylifecycle.c 2024-03-27 14:40:16.339134322 +0000
+@@ -1723,6 +1723,20 @@
+ if (!is_valid_fd(fd))
+ Py_RETURN_NONE;
+
++ /* Check that stdin, etc is not a directory
++ Using shell redirection, you can redirect stdin to a directory,
++ crashing the Python interpreter. Catch this common mistake here
++ and output a useful error message. Note that under MS Windows,
++ the shell already prevents that. */
++#ifndef MS_WINDOWS
++ struct _Py_stat_struct sb;
++ if (_Py_fstat_noraise(fd, &sb) == 0 &&
++ S_ISDIR(sb.st_mode)) {
++ // "name" is a directory, cannot continue
++ Py_RETURN_NONE;
++ }
++#endif
++
+ /* stdin is always opened in buffered mode, first because it shouldn't
+ make a difference in common use cases, second because TextIOWrapper
+ depends on the presence of a read1() method which only exists on
+@@ -1854,19 +1868,6 @@
+ PyStatus res = _PyStatus_OK();
+ PyConfig *config = &interp->config;
+
+- /* Check that stdin is not a directory
+- Using shell redirection, you can redirect stdin to a directory,
+- crashing the Python interpreter. Catch this common mistake here
+- and output a useful error message. Note that under MS Windows,
+- the shell already prevents that. */
+-#ifndef MS_WINDOWS
+- struct _Py_stat_struct sb;
+- if (_Py_fstat_noraise(fileno(stdin), &sb) == 0 &&
+- S_ISDIR(sb.st_mode)) {
+- return _PyStatus_ERR("<stdin> is a directory, cannot continue");
+- }
+-#endif
+-
+ /* Hack to avoid a nasty recursion issue when Python is invoked
+ in verbose mode: pre-import the Latin-1 and UTF-8 codecs */
+ if ((m = PyImport_ImportModule("encodings.utf_8")) == NULL) {
diff --git a/external/python3/internal-zlib.patch.0 b/external/python3/internal-zlib.patch.0
index de68d9e7dec8..d4305c6df95d 100644
--- a/external/python3/internal-zlib.patch.0
+++ b/external/python3/internal-zlib.patch.0
@@ -1,6 +1,6 @@
--- configure
+++ configure
-@@ -11607,13 +11607,13 @@
+@@ -12333,13 +12333,13 @@
;;
esac
@@ -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/macos-11.patch.0 b/external/python3/macos-11.patch.0
index e2f13ac4c426..2c8b419bbdb9 100644
--- a/external/python3/macos-11.patch.0
+++ b/external/python3/macos-11.patch.0
@@ -1,6 +1,6 @@
--- setup.py
+++ setup.py
-@@ -670,7 +670,10 @@
+@@ -655,7 +655,10 @@
add_dir_to_list(self.compiler.include_dirs,
sysconfig.get_config_var("INCLUDEDIR"))
@@ -14,7 +14,7 @@
# if a file is found in one of those directories, it can
--- Modules/_posixsubprocess.c
+++ Modules/_posixsubprocess.c
-@@ -31,6 +31,8 @@
+@@ -30,6 +30,8 @@
# define SYS_getdents64 __NR_getdents64
#endif
@@ -23,7 +23,7 @@
#if defined(__sun) && defined(__SVR4)
/* readdir64 is used to work around Solaris 9 bug 6395699. */
# define readdir readdir64
-@@ -202,7 +202,7 @@
+@@ -201,7 +203,7 @@
#endif
#ifdef _SC_OPEN_MAX
local_max_fd = sysconf(_SC_OPEN_MAX);
diff --git a/external/python3/python-3.3.0-darwin.patch.1 b/external/python3/python-3.3.0-darwin.patch.1
index 27a355e2ad21..d262d55cd5b3 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@
@@ -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
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..880e4a9cfb5b 100644
--- a/external/python3/python-3.5.4-msvc-disable.patch.1
+++ b/external/python3/python-3.5.4-msvc-disable.patch.1
@@ -1,9 +1,9 @@
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 @@
+--- python3.orig/PCbuild/pcbuild.sln 2023-08-25 04:36:32.000000000 +0900
++++ python3/PCbuild/pcbuild.sln 2023-09-20 17:43:05.442089400 +0900
+@@ -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,8 +29,6 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_socket", "_socket.vcxproj", "{86937F53-C189-40EF-8CE8-8759D8E7D480}"
EndProject
@@ -21,15 +21,14 @@ diff -ru python3.orig/PCbuild/pcbuild.sln python3/PCbuild/pcbuild.sln
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ssl", "_ssl.vcxproj", "{C6E20F84-3247-4AD6-B051-B073268F73BA}"
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}"
+@@ -41,24 +37,14 @@
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}"
-EndProject
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bz2", "_bz2.vcxproj", "{73FCD2BD-F133-46B7-8EC1-144CD82A59D5}"
--EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bz2", "_bz2.vcxproj", "{73FCD2BD-F133-46B7-8EC1-144CD82A59D5}"
+ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "select", "select.vcxproj", "{18CAE28C-B454-46C1-87A0-493D91D97F03}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_lzma", "_lzma.vcxproj", "{F9D71780-F393-11E0-BE50-0800200C9A66}"
@@ -47,7 +46,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 +79,6 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_queue", "_queue.vcxproj", "{78D80A15-BD8C-44E2-B49E-1F05B0A0A687}"
EndProject
diff --git a/external/python3/python-3.5.tweak.strip.soabi.patch b/external/python3/python-3.5.tweak.strip.soabi.patch
index 48ac7f82f8be..4c2bb2bb9a29 100644
--- a/external/python3/python-3.5.tweak.strip.soabi.patch
+++ b/external/python3/python-3.5.tweak.strip.soabi.patch
@@ -1,7 +1,7 @@
diff -ru python3.orig/configure python3/configure
--- misc/python3.orig/configure 2015-07-26 21:14:31.127377193 +0200
+++ misc/python3/configure 2015-07-26 21:21:34.975405648 +0200
-@@ -14388,7 +14388,7 @@
+@@ -15229,7 +15229,7 @@
$as_echo "$ABIFLAGS" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking SOABI" >&5
$as_echo_n "checking SOABI... " >&6; }
diff --git a/external/python3/python-3.7.6-msvc-ssl.patch.1 b/external/python3/python-3.7.6-msvc-ssl.patch.1
index 7c4a6ebc0fb7..50b1c65645df 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" />
@@ -14,12 +14,14 @@ No use for applink.c OPENSSL_Applink, everything is compiled with the same MSVC
<ResourceCompile Include="..\PC\python_nt.rc" />
--- python3/PCbuild/openssl.props.orig 2019-12-23 16:20:34.588135900 +0100
+++ python3/PCbuild/openssl.props 2019-12-23 16:20:51.074001300 +0100
-@@ -6,8 +6,6 @@
+@@ -10,9 +10,7 @@
+ </Link>
</ItemDefinitionGroup>
<PropertyGroup>
- <_DLLSuffix>-1_1</_DLLSuffix>
+- <_DLLSuffix>-1_1</_DLLSuffix>
- <_DLLSuffix Condition="$(Platform) == 'ARM'">$(_DLLSuffix)-arm</_DLLSuffix>
- <_DLLSuffix Condition="$(Platform) == 'ARM64'">$(_DLLSuffix)-arm64</_DLLSuffix>
++ <_DLLSuffix>-3</_DLLSuffix>
</PropertyGroup>
<ItemGroup>
<_SSLDLL Include="$(opensslOutDir)\libcrypto$(_DLLSuffix).dll" />
diff --git a/external/python3/python-3.8-msvc-libffi.patch.1 b/external/python3/python-3.8-msvc-libffi.patch.1
new file mode 100644
index 000000000000..674043a7dca6
--- /dev/null
+++ b/external/python3/python-3.8-msvc-libffi.patch.1
@@ -0,0 +1,16 @@
+--- python3/PCbuild/libffi.props.orig 2023-08-25 04:36:32.000000000 +0900
++++ python3/PCbuild/libffi.props 2023-10-14 15:13:24.850511531 +0900
+@@ -6,11 +6,11 @@
+ </ClCompile>
+ <Link>
+ <AdditionalLibraryDirectories>$(libffiOutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+- <AdditionalDependencies>libffi-7.lib;%(AdditionalDependencies)</AdditionalDependencies>
++ <AdditionalDependencies>libffi-8.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+- <_LIBFFIDLL Include="$(libffiOutDir)\libffi-7.dll" />
++ <_LIBFFIDLL Include="$(libffiOutDir)\libffi-8.dll" />
+ </ItemGroup>
+ <Target Name="_CopyLIBFFIDLL" Inputs="@(_LIBFFIDLL)" Outputs="@(_LIBFFIDLL->'$(OutDir)%(Filename)%(Extension)')" AfterTargets="Build">
+ <Copy SourceFiles="@(_LIBFFIDLL)" DestinationFolder="$(OutDir)" />
diff --git a/external/python3/tsan.patch.0 b/external/python3/tsan.patch.0
new file mode 100644
index 000000000000..d599ec046109
--- /dev/null
+++ b/external/python3/tsan.patch.0
@@ -0,0 +1,10 @@
+--- Python/ceval_gil.h
++++ Python/ceval_gil.h
+@@ -135,6 +135,7 @@
+
+ static void recreate_gil(struct _gil_runtime_state *gil)
+ {
++ _Py_ANNOTATE_RWLOCK_RELEASED(&gil->locked, 1);
+ _Py_ANNOTATE_RWLOCK_DESTROY(&gil->locked);
+ /* XXX should we destroy the old OS resources here? */
+ create_gil(gil);
diff --git a/external/python3/ubsan.patch.0 b/external/python3/ubsan.patch.0
index 9f458b1e0f95..d44fbe055c86 100644
--- a/external/python3/ubsan.patch.0
+++ b/external/python3/ubsan.patch.0
@@ -20,7 +20,7 @@
This is clc or stc, together with the first byte of the jmp. */
--- Modules/posixmodule.c
+++ Modules/posixmodule.c
-@@ -23,6 +23,9 @@
+@@ -13998,6 +13998,9 @@
};
static int
@@ -32,7 +32,7 @@
#ifdef F_OK
--- Objects/listobject.c
+++ Objects/listobject.c
-@@ -548,7 +548,7 @@
+@@ -554,7 +554,7 @@
dest[i] = v;
}
src = b->ob_item;