| Summary: | Use PyConfig for setting Python home directory | ||
|---|---|---|---|
| Product: | LibreOffice | Reporter: | Gwyn Ciesla <gwync> |
| Component: | LibreOffice | Assignee: | Buovjaga <ilmari.lauhakangas> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | 79045_79045, cloph, ilmari.lauhakangas, sberg.fun |
| Priority: | medium | ||
| Version: | 7.6.3.1 rc | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | target:24.8.0 | ||
| Crash report or crash signature: | Regression By: | ||
| Attachments: | Patch to use PyConfig | ||
Cloph, Stephan, should we do something with this? For added context, Python 3.13 will be the system Python in Fedora 41, which should be released in late 2024. Created attachment 191534 [details] Patch to use PyConfig I created a patch for this and at least it doesn't break anything (tested with a Python extension and running a UI test), but the problem is that our Alma Linux machines in our CI say in their console log: checking for python3 version... 3.6 Python Initialization Configuration is said to be "New in version 3.8": https://docs.python.org/3/c-api/init_config.html So I can't submit the patch right away. Probably someone can look at this next year. Submitted https://gerrit.libreoffice.org/c/core/+/161089 Thanks to Thorsten and Noel for fallback tip. Ilmari Lauhakangas committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/da0e9240bf6505ac3a67ff985705950566c66144 tdf#158447 Use PyConfig for setting Python home directory with Python >= 3.8 It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback. |
Description: libreoffice fails to build with Python 3.13.0a1. /builddir/build/BUILD/libreoffice-7.6.3.1/pyuno/source/loader/pyuno_loader.cxx: In function ‘void pyuno_loader::setPythonHome(const rtl::OUString&)’: /builddir/build/BUILD/libreoffice-7.6.3.1/pyuno/source/loader/pyuno_loader.cxx:133:5: error: ‘Py_SetPythonHome’ was not declared in this scope; did you mean ‘Py_GetPythonHome’? 133 | Py_SetPythonHome(wide); // deprecated since python 3.11 | ^~~~~~~~~~~~~~~~ | Py_GetPythonHome According to https://docs.python.org/3.13/whatsnew/3.13.html: Remove the following old functions to configure the Python initialization, deprecated in Python 3.11: PySys_AddWarnOptionUnicode(): use PyConfig.warnoptions instead. PySys_AddWarnOption(): use PyConfig.warnoptions instead. PySys_AddXOption(): use PyConfig.xoptions instead. PySys_HasWarnOptions(): use PyConfig.xoptions instead. PySys_SetArgvEx(): set PyConfig.argv instead. PySys_SetArgv(): set PyConfig.argv instead. PySys_SetPath(): set PyConfig.module_search_paths instead. Py_SetPath(): set PyConfig.module_search_paths instead. Py_SetProgramName(): set PyConfig.program_name instead. Py_SetPythonHome(): set PyConfig.home instead. Py_SetStandardStreamEncoding(): set PyConfig.stdio_encoding instead, and set also maybe PyConfig.legacy_windows_stdio (on Windows). _Py_SetProgramFullPath(): set PyConfig.executable instead. https://docs.python.org/3.13/whatsnew/3.13.html https://bugzilla.redhat.com/show_bug.cgi?id=2250857 Actual Results: libreoffice fails to build with Python 3.13.0a1. /builddir/build/BUILD/libreoffice-7.6.3.1/pyuno/source/loader/pyuno_loader.cxx: In function ‘void pyuno_loader::setPythonHome(const rtl::OUString&)’: /builddir/build/BUILD/libreoffice-7.6.3.1/pyuno/source/loader/pyuno_loader.cxx:133:5: error: ‘Py_SetPythonHome’ was not declared in this scope; did you mean ‘Py_GetPythonHome’? 133 | Py_SetPythonHome(wide); // deprecated since python 3.11 | ^~~~~~~~~~~~~~~~ | Py_GetPythonHome Expected Results: Build succeeds Reproducible: Always User Profile Reset: No Additional Info: Python 3.13 will likely be shipped in Fedora 41.