From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3068E3858C2C; Tue, 7 Dec 2021 16:08:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3068E3858C2C From: "kevinb at redhat dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: python X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kevinb at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Dec 2021 16:08:17 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28668 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 deprec= ated in Python 3.11. When that happens, we can expect to error messages like th= is when building GDB with -Werror: ../../gdb/python/python.c:1757:21: error: 'void Py_SetProgramName(const wchar_t*)' is deprecated [-Werror=3Ddeprecated-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 pytho= n.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 PyCo= nfig calls from the existing calls to Py_SetProgramName. --=20 You are receiving this mail because: You are on the CC list for the bug.=