unit/docs
Andrew Clayton 491d0f700f Python: Added support for Python 3.11.
Python 3.8 added a new Python initialisation configuration API[0].

Python 3.11 marked the old API as deprecated resulting in the following
compiler warnings which we treat as errors, failing the build

src/python/nxt_python.c: In function ‘nxt_python_start’:
src/python/nxt_python.c:130:13: error: ‘Py_SetProgramName’ is deprecated [-Werror=deprecated-declarations]
  130 |             Py_SetProgramName(nxt_py_home);
      |             ^~~~~~~~~~~~~~~~~
In file included from /opt/python-3.11/include/python3.11/Python.h:94,
                 from src/python/nxt_python.c:7:
/opt/python-3.11/include/python3.11/pylifecycle.h:37:38: note: declared here
   37 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *);
      |                                      ^~~~~~~~~~~~~~~~~
src/python/nxt_python.c:134:13: error: ‘Py_SetPythonHome’ is deprecated [-Werror=deprecated-declarations]
  134 |             Py_SetPythonHome(nxt_py_home);
      |             ^~~~~~~~~~~~~~~~
/opt/python-3.11/include/python3.11/pylifecycle.h:40:38: note: declared here
   40 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetPythonHome(const wchar_t *);
      |                                      ^~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

We actually have a few config scenarios: Python < 3, Python >= 3.0 < 3.8
and for Python 3 we have two configs where we select one based on
virtual environment setup.

Factor out the Python 3 config initialisation into its own function.  We
actually create two functions, one for Python 3.8+ and one for older
Python 3.  We pick the right function to use at build time.

The new API also has error checking (where the old API doesn't) which we
handle.

[0]: https://peps.python.org/pep-0587/

Closes: <https://github.com/nginx/unit/issues/710>
[ Andrew: Expanded upon patch from @sandeep-gh ]
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2022-12-06 02:51:03 +00:00
..
man Added a missing .El directive in man page source. 2021-03-24 16:49:59 +00:00
change_log_conf.dtd Added changelogs generation tools. 2017-10-19 17:48:58 +03:00
change_log_conf.xml Added changelogs generation tools. 2017-10-19 17:48:58 +03:00
changes.dtd Added changelogs generation tools. 2017-10-19 17:48:58 +03:00
changes.xml Python: Added support for Python 3.11. 2022-12-06 02:51:03 +00:00
changes.xsls Docs: special handling for empty "date" and "time" XML attributes. 2020-12-08 13:17:21 +03:00
changes.xslt Docs: special handling for empty "date" and "time" XML attributes. 2020-12-08 13:17:21 +03:00
Makefile Packages: added Ubuntu 21.04 "hirsute" support. 2021-05-27 13:12:52 +03:00
unitlogo.svg Updated the GitHub page banner. 2022-09-05 10:42:18 +01:00