public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "kevinb at redhat dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug python/28668] New: Py_SetProgramName will be deprecated in Python 3.11 Date: Tue, 07 Dec 2021 16:08:16 +0000 [thread overview] Message-ID: <bug-28668-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=28668 Bug ID: 28668 Summary: Py_SetProgramName will be deprecated in Python 3.11 Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: python Assignee: unassigned at sourceware dot org Reporter: kevinb at redhat dot com Target Milestone: --- 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. -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2021-12-07 16:08 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-07 16:08 kevinb at redhat dot com [this message] 2022-07-01 8:16 ` [Bug python/28668] " mark at klomp dot org 2023-03-17 18:34 ` tromey at sourceware dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-28668-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).