* [PATCH v2] Require Python 3.4
@ 2025-05-29 17:55 Tom Tromey
2025-05-29 23:31 ` Kevin Buettner
2025-05-30 7:07 ` Eli Zaretskii
0 siblings, 2 replies; 7+ messages in thread
From: Tom Tromey @ 2025-05-29 17:55 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey, Eli Zaretskii, Kevin Buettner, Tom de Vries
I believe we previously agreed that the minimum supported Python
version should be 3.4. This patch makes this change, harmonizing the
documentation (which was inconsistent about the minimum version) and
the code.
New in v2: rebased, and removed a pre-3.4 workaround from __init__.py.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-by: Kevin Buettner <kevinb@redhat.com>
Acked-By: Tom de Vries <tdevries@suse.de>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31870
---
gdb/NEWS | 2 ++
gdb/README | 2 +-
gdb/configure | 4 ++--
gdb/configure.ac | 4 ++--
gdb/doc/gdb.texinfo | 2 +-
gdb/python/lib/gdb/__init__.py | 7 +------
gdb/python/py-gdb-readline.c | 4 ----
gdb/python/python-internal.h | 13 ++-----------
8 files changed, 11 insertions(+), 27 deletions(-)
diff --git a/gdb/NEWS b/gdb/NEWS
index 2e48a00df5a..970a527a64c 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -124,6 +124,8 @@ info threads [-gid] [-stopped] [-running] [ID]...
* Python API
+ ** GDB no longer supports Python versions less than 3.4.
+
** New class gdb.Color for dealing with colors.
** New constant gdb.PARAM_COLOR represents color type of a
diff --git a/gdb/README b/gdb/README
index 5a0030511d6..3c42936b679 100644
--- a/gdb/README
+++ b/gdb/README
@@ -533,7 +533,7 @@ more obscure GDB `configure' options are not listed here.
GDB scripting much more powerful than the restricted CLI
scripting language. If your host does not have Python installed,
you can find it on `http://www.python.org/download/'. The oldest
- version of Python supported by GDB is 3.2. The optional argument
+ version of Python supported by GDB is 3.4. The optional argument
PYTHON is used to find the Python headers and libraries. It can
be either the name of a Python executable, or the name of the
directory in which Python is installed.
diff --git a/gdb/configure b/gdb/configure
index 683fcaef9fe..b34f66679e8 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -28167,8 +28167,8 @@ int
main ()
{
- #if PY_MAJOR_VERSION != 3
- # error "We only support Python 3"
+ #if PY_VERSION_HEX < 0x03040000
+ # error "Minimum supported Python version is 3.4"
#endif
Py_Initialize ();
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 052d0319a04..9529e850154 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -740,8 +740,8 @@ AC_DEFUN([AC_TRY_LIBPYTHON],
found_usable_python=no
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "Python.h"]],
[[
- #if PY_MAJOR_VERSION != 3
- # error "We only support Python 3"
+ #if PY_VERSION_HEX < 0x03040000
+ # error "Minimum supported Python version is 3.4"
#endif
Py_Initialize ();
]])],
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 05f550233fe..267647108dd 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -41466,7 +41466,7 @@ libpython is present and found at configure time.) Python makes
@value{GDBN} scripting much more powerful than the restricted CLI
scripting language. If your host does not have Python installed, you
can find it on @url{http://www.python.org/download/}. The oldest version
-of Python supported by GDB is 3.0.1. The optional argument @var{python}
+of Python supported by GDB is 3.4. The optional argument @var{python}
is used to find the Python headers and libraries. It can be either
the name of a Python executable, or the name of the directory in which
Python is installed.
diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py
index 69c15b16d87..03eb426b662 100644
--- a/gdb/python/lib/gdb/__init__.py
+++ b/gdb/python/lib/gdb/__init__.py
@@ -19,12 +19,7 @@ import sys
import threading
import traceback
from contextlib import contextmanager
-
-# Python 3 moved "reload"
-if sys.version_info >= (3, 4):
- from importlib import reload
-else:
- from imp import reload
+from importlib import reload
import _gdb
diff --git a/gdb/python/py-gdb-readline.c b/gdb/python/py-gdb-readline.c
index ea3a3850312..70ceebb36a1 100644
--- a/gdb/python/py-gdb-readline.c
+++ b/gdb/python/py-gdb-readline.c
@@ -29,11 +29,7 @@
static char *
gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
-#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 4
const char *prompt)
-#else
- char *prompt)
-#endif
{
int n;
const char *p = NULL;
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 5262d767529..bdccb265441 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -88,6 +88,8 @@
#include <frameobject.h>
#include "py-ref.h"
+static_assert (PY_VERSION_HEX >= 0x03040000);
+
#define Py_TPFLAGS_CHECKTYPES 0
/* If Python.h does not define WITH_THREAD, then the various
@@ -135,17 +137,6 @@ typedef unsigned long gdb_py_ulongest;
#endif /* HAVE_LONG_LONG */
-#if PY_VERSION_HEX < 0x03020000
-typedef long Py_hash_t;
-#endif
-
-/* PyMem_RawMalloc appeared in Python 3.4. For earlier versions, we can just
- fall back to PyMem_Malloc. */
-
-#if PY_VERSION_HEX < 0x03040000
-#define PyMem_RawMalloc PyMem_Malloc
-#endif
-
/* A template variable holding the format character (as for
Py_BuildValue) for a given type. */
template<typename T>
base-commit: 2490dbf4e484616e6aecf3c57efcd17a819fae5b
--
2.49.0
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v2] Require Python 3.4
2025-05-29 17:55 [PATCH v2] Require Python 3.4 Tom Tromey
@ 2025-05-29 23:31 ` Kevin Buettner
2025-05-30 13:11 ` Tom Tromey
2025-05-30 7:07 ` Eli Zaretskii
1 sibling, 1 reply; 7+ messages in thread
From: Kevin Buettner @ 2025-05-29 23:31 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches, Eli Zaretskii, Tom de Vries
On Thu, 29 May 2025 11:55:52 -0600
Tom Tromey <tromey@adacore.com> wrote:
> I believe we previously agreed that the minimum supported Python
> version should be 3.4. This patch makes this change, harmonizing the
> documentation (which was inconsistent about the minimum version) and
> the code.
>
> New in v2: rebased, and removed a pre-3.4 workaround from __init__.py.
>
> Reviewed-By: Eli Zaretskii <eliz@gnu.org>
> Approved-by: Kevin Buettner <kevinb@redhat.com>
> Acked-By: Tom de Vries <tdevries@suse.de>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31870
LGTM, and it still has my approval.
Kevin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] Require Python 3.4
2025-05-29 23:31 ` Kevin Buettner
@ 2025-05-30 13:11 ` Tom Tromey
2025-07-25 9:33 ` Matthieu Longo
0 siblings, 1 reply; 7+ messages in thread
From: Tom Tromey @ 2025-05-30 13:11 UTC (permalink / raw)
To: Kevin Buettner; +Cc: Tom Tromey, gdb-patches, Eli Zaretskii, Tom de Vries
>>>>> "Kevin" == Kevin Buettner <kevinb@redhat.com> writes:
Kevin> On Thu, 29 May 2025 11:55:52 -0600
Kevin> Tom Tromey <tromey@adacore.com> wrote:
>> I believe we previously agreed that the minimum supported Python
>> version should be 3.4. This patch makes this change, harmonizing the
>> documentation (which was inconsistent about the minimum version) and
>> the code.
>>
>> New in v2: rebased, and removed a pre-3.4 workaround from __init__.py.
>>
>> Reviewed-By: Eli Zaretskii <eliz@gnu.org>
>> Approved-by: Kevin Buettner <kevinb@redhat.com>
>> Acked-By: Tom de Vries <tdevries@suse.de>
>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31870
Kevin> LGTM, and it still has my approval.
Thanks, I'm checking it in.
Tom
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] Require Python 3.4
2025-05-30 13:11 ` Tom Tromey
@ 2025-07-25 9:33 ` Matthieu Longo
2025-07-25 9:38 ` Tom de Vries
2025-07-25 11:06 ` Eli Zaretskii
0 siblings, 2 replies; 7+ messages in thread
From: Matthieu Longo @ 2025-07-25 9:33 UTC (permalink / raw)
To: Tom Tromey, Kevin Buettner; +Cc: gdb-patches, Eli Zaretskii, Tom de Vries
On 2025-05-30 14:11, Tom Tromey wrote:
>>>>>> "Kevin" == Kevin Buettner <kevinb@redhat.com> writes:
>
> Kevin> On Thu, 29 May 2025 11:55:52 -0600
> Kevin> Tom Tromey <tromey@adacore.com> wrote:
>
>>> I believe we previously agreed that the minimum supported Python
>>> version should be 3.4. This patch makes this change, harmonizing the
>>> documentation (which was inconsistent about the minimum version) and
>>> the code.
>>>
>>> New in v2: rebased, and removed a pre-3.4 workaround from __init__.py.
>>>
>>> Reviewed-By: Eli Zaretskii <eliz@gnu.org>
>>> Approved-by: Kevin Buettner <kevinb@redhat.com>
>>> Acked-By: Tom de Vries <tdevries@suse.de>
>>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31870
>
> Kevin> LGTM, and it still has my approval.
>
> Thanks, I'm checking it in.
>
> Tom
Hi,
What is the reason for targeting Python 3.4 as the minimal supported
version ?
What is the distribution with such an old Python ?
Matthieu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] Require Python 3.4
2025-07-25 9:33 ` Matthieu Longo
@ 2025-07-25 9:38 ` Tom de Vries
2025-07-25 11:06 ` Eli Zaretskii
1 sibling, 0 replies; 7+ messages in thread
From: Tom de Vries @ 2025-07-25 9:38 UTC (permalink / raw)
To: Matthieu Longo, Tom Tromey, Kevin Buettner; +Cc: gdb-patches, Eli Zaretskii
On 7/25/25 11:33, Matthieu Longo wrote:
> On 2025-05-30 14:11, Tom Tromey wrote:
>>>>>>> "Kevin" == Kevin Buettner <kevinb@redhat.com> writes:
>>
>> Kevin> On Thu, 29 May 2025 11:55:52 -0600
>> Kevin> Tom Tromey <tromey@adacore.com> wrote:
>>
>>>> I believe we previously agreed that the minimum supported Python
>>>> version should be 3.4. This patch makes this change, harmonizing the
>>>> documentation (which was inconsistent about the minimum version) and
>>>> the code.
>>>>
>>>> New in v2: rebased, and removed a pre-3.4 workaround from __init__.py.
>>>>
>>>> Reviewed-By: Eli Zaretskii <eliz@gnu.org>
>>>> Approved-by: Kevin Buettner <kevinb@redhat.com>
>>>> Acked-By: Tom de Vries <tdevries@suse.de>
>>>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31870
>>
>> Kevin> LGTM, and it still has my approval.
>>
>> Thanks, I'm checking it in.
>>
>> Tom
>
> Hi,
>
> What is the reason for targeting Python 3.4 as the minimal supported
> version ?
> What is the distribution with such an old Python ?
>
See the PR.
Thanks,
- Tom
> Matthieu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] Require Python 3.4
2025-07-25 9:33 ` Matthieu Longo
2025-07-25 9:38 ` Tom de Vries
@ 2025-07-25 11:06 ` Eli Zaretskii
1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2025-07-25 11:06 UTC (permalink / raw)
To: Matthieu Longo; +Cc: tromey, kevinb, gdb-patches, tdevries
> Date: Fri, 25 Jul 2025 10:33:44 +0100
> Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
> Eli Zaretskii <eliz@gnu.org>, Tom de Vries <tdevries@suse.de>
> From: Matthieu Longo <matthieu.longo@arm.com>
>
> What is the reason for targeting Python 3.4 as the minimal supported
> version ?
> What is the distribution with such an old Python ?
The oldest Python 3 version that supports Windows XP is 3.44. I
believe this is one of the reasons (f not _the_ reason): GDB still
attempts not to drop support of Windows XP.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] Require Python 3.4
2025-05-29 17:55 [PATCH v2] Require Python 3.4 Tom Tromey
2025-05-29 23:31 ` Kevin Buettner
@ 2025-05-30 7:07 ` Eli Zaretskii
1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2025-05-30 7:07 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches, kevinb, tdevries
> From: Tom Tromey <tromey@adacore.com>
> Cc: Tom Tromey <tromey@adacore.com>,
> Eli Zaretskii <eliz@gnu.org>,
> Kevin Buettner <kevinb@redhat.com>,
> Tom de Vries <tdevries@suse.de>
> Date: Thu, 29 May 2025 11:55:52 -0600
>
> I believe we previously agreed that the minimum supported Python
> version should be 3.4. This patch makes this change, harmonizing the
> documentation (which was inconsistent about the minimum version) and
> the code.
>
> New in v2: rebased, and removed a pre-3.4 workaround from __init__.py.
>
> Reviewed-By: Eli Zaretskii <eliz@gnu.org>
> Approved-by: Kevin Buettner <kevinb@redhat.com>
> Acked-By: Tom de Vries <tdevries@suse.de>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31870
> ---
> gdb/NEWS | 2 ++
> gdb/README | 2 +-
> gdb/configure | 4 ++--
> gdb/configure.ac | 4 ++--
> gdb/doc/gdb.texinfo | 2 +-
> gdb/python/lib/gdb/__init__.py | 7 +------
> gdb/python/py-gdb-readline.c | 4 ----
> gdb/python/python-internal.h | 13 ++-----------
> 8 files changed, 11 insertions(+), 27 deletions(-)
Thanks, the documentation parts are okay.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-07-25 11:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-29 17:55 [PATCH v2] Require Python 3.4 Tom Tromey
2025-05-29 23:31 ` Kevin Buettner
2025-05-30 13:11 ` Tom Tromey
2025-07-25 9:33 ` Matthieu Longo
2025-07-25 9:38 ` Tom de Vries
2025-07-25 11:06 ` Eli Zaretskii
2025-05-30 7:07 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox