Py_SetProgramName, which is called from gdb/python/python.c, will be deprecated in Python 3.11. When that happens, we can expect to error messages like this when building GDB with -Werror: ../../gdb/python/python.c:1757:21: error: 'void Py_SetProgramName(const wchar_t*)' is deprecated [-Werror=deprecated-declarations] 1757 | Py_SetProgramName (progname_copy); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ In file included from /usr/include/python3.11/Python.h:92, from ../../gdb/python/python-internal.h:86, from ../../gdb/python/python.c:92: /usr/include/python3.11/pylifecycle.h:37:38: note: declared here 37 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *); | ^~~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors In order to work around this problem, -Wno-deprecated-declarations may be appended to the set of warning flags used to build GDB. However, long term, we'll need to adjust do_start_initialization() in python.c to use the PyConfig mechanisms introduced in Python 3.8. For reference, see: https://bugs.python.org/issue44113 https://docs.python.org/3.11/whatsnew/3.11.html https://docs.python.org/3.11/c-api/init_config.html#c.PyConfig The latter link contains an example which shows how to call PyConfig_SetString() to set the program_name field in the PyConfig struct. Sadly, we'll still need to support the use of Py_SetProgramName in gdb/python/python.c because (I anticipate that) the GDB community will want to support building against Python versions older than 3.8 for a while yet. I recommend use of '#if Py_VERSION_HEX < 0x308000' to separate the new PyConfig calls from the existing calls to Py_SetProgramName.
Kevin posted a patch: https://sourceware.org/pipermail/gdb-patches/2022-June/190460.html
This was fixed.