This is an automated email from the ASF dual-hosted git repository.
truckman pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/trunk by this push:
new c83c60c7e6 Fix build with python >= 3.12
c83c60c7e6 is described below
commit c83c60c7e6aac8747783658329758074eef3eb8c
Author: Don Lewis <[email protected]>
AuthorDate: Mon Jan 19 17:18:24 2026 -0800
Fix build with python >= 3.12
Fix the build with system python versions >= 3.12. The python
setuptools module is required, so test for it indirectly in configure
and flag its absence.
---
main/configure.ac | 6 ++++++
main/pyuno/source/module/pyuno_type.cxx | 4 ++++
2 files changed, 10 insertions(+)
diff --git a/main/configure.ac b/main/configure.ac
index e1802ae235..78ff214ac9 100644
--- a/main/configure.ac
+++ b/main/configure.ac
@@ -3979,6 +3979,9 @@ if test "$_os" = "Darwin" && test "$with_system_python"
!= "no"; then
_python_version=`$_python -c "import sys; print sys.version;" | head
-c 3`
AC_MSG_RESULT([compiling against system python (version
$_python_version)])
+ if ! $_python -c "import distutils.sysconfig;"; then
+ AC_MSG_ERROR([python setuptools module is required to provide
distutils for python >= 3.12])
+ fi
_python_ver=`$_python -c "import distutils.sysconfig;
print(distutils.sysconfig.get_config_var('VERSION'));"`
if test -d
"/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver";
then
@@ -3999,6 +4002,9 @@ elif test -n "$with_system_python" -o -n
"$with_system_libs" && \
AC_MSG_RESULT([external])
AM_PATH_PYTHON([2.7])
+ if ! $_python -c "import distutils.sysconfig;"; then
+ AC_MSG_ERROR([python setuptools module is required to provide distutils
for python >= 3.12])
+ fi
python_include=`$PYTHON -c "import distutils.sysconfig;
print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
python_version=`$PYTHON -c "import distutils.sysconfig;
print(distutils.sysconfig.get_config_var('VERSION'));"`
# Python 3.8 and later distinguish building Python modules from linking to
the libpython:
diff --git a/main/pyuno/source/module/pyuno_type.cxx
b/main/pyuno/source/module/pyuno_type.cxx
index 521f1aa6b7..4f866d2e4f 100644
--- a/main/pyuno/source/module/pyuno_type.cxx
+++ b/main/pyuno/source/module/pyuno_type.cxx
@@ -150,7 +150,11 @@ sal_Unicode PyChar2Unicode( PyObject *obj ) throw (
RuntimeException )
Reference< XInterface > () );
}
+#if PY_VERSION_HEX >= 0x030C0000
+ if( PyUnicode_GetLength( value.get() ) < 1 )
+#else
if( PyUnicode_GetSize( value.get() ) < 1 )
+#endif
{
throw RuntimeException(
USTR_ASCII( "uno.Char contains an empty unicode string" ),