This is an automated email from the ASF dual-hosted git repository. jimjag pushed a commit to branch AOO41X in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 484e1a19894141bf8a1e637e9b1bc079f14b743e 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. (cherry picked from commit c83c60c7e6aac8747783658329758074eef3eb8c) --- 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 9672de2d53..91837cfd8b 100644 --- a/main/configure.ac +++ b/main/configure.ac @@ -3958,6 +3958,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 @@ -3978,6 +3981,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_CFLAGS="-I$python_include" diff --git a/main/pyuno/source/module/pyuno_type.cxx b/main/pyuno/source/module/pyuno_type.cxx index a157a93867..ffd73d3d88 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" ),
