* [PATCH] Require Python 3.4
@ 2024-10-16 16:00 Tom Tromey
2024-10-16 18:24 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Tom Tromey @ 2024-10-16 16:00 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
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.
---
gdb/NEWS | 2 ++
gdb/README | 2 +-
gdb/configure | 4 ++--
gdb/configure.ac | 4 ++--
gdb/doc/gdb.texinfo | 2 +-
gdb/python/py-gdb-readline.c | 4 ----
gdb/python/python-internal.h | 13 ++-----------
7 files changed, 10 insertions(+), 21 deletions(-)
diff --git a/gdb/NEWS b/gdb/NEWS
index 42668cbc057..544e805915e 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -51,6 +51,8 @@
* Python API
+ ** GDB no longer supports Python versions less than 3.4.
+
** Added gdb.record.clear. Clears the trace data of the current recording.
This forces re-decoding of the trace for successive commands.
diff --git a/gdb/README b/gdb/README
index d85c37d5d17..e3bfda45da1 100644
--- a/gdb/README
+++ b/gdb/README
@@ -516,7 +516,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 ec9bbd3a842..e3e9d1c8ec7 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -28157,8 +28157,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 21f5dc8dd30..250b014e56c 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -734,8 +734,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 554608da9fd..e12104867c4 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -41182,7 +41182,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/py-gdb-readline.c b/gdb/python/py-gdb-readline.c
index dd0ee45fe2e..d8782a9ff33 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 d723c4d577b..d3337de9043 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -87,6 +87,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
@@ -134,17 +136,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>
--
2.47.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Require Python 3.4
2024-10-16 16:00 [PATCH] Require Python 3.4 Tom Tromey
@ 2024-10-16 18:24 ` Eli Zaretskii
2024-10-23 22:38 ` Kevin Buettner
2024-10-24 12:11 ` Tom de Vries
2 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2024-10-16 18:24 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> From: Tom Tromey <tromey@adacore.com>
> Cc: Tom Tromey <tromey@adacore.com>
> Date: Wed, 16 Oct 2024 10:00:00 -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.
> ---
> gdb/NEWS | 2 ++
> gdb/README | 2 +-
> gdb/configure | 4 ++--
> gdb/configure.ac | 4 ++--
> gdb/doc/gdb.texinfo | 2 +-
> gdb/python/py-gdb-readline.c | 4 ----
> gdb/python/python-internal.h | 13 ++-----------
> 7 files changed, 10 insertions(+), 21 deletions(-)
Thanks, the documentation parts are okay.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Require Python 3.4
2024-10-16 16:00 [PATCH] Require Python 3.4 Tom Tromey
2024-10-16 18:24 ` Eli Zaretskii
@ 2024-10-23 22:38 ` Kevin Buettner
2024-10-24 12:11 ` Tom de Vries
2 siblings, 0 replies; 4+ messages in thread
From: Kevin Buettner @ 2024-10-23 22:38 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On Wed, 16 Oct 2024 10:00:00 -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.
The non-documentation parts LGTM.
Approved-by: Kevin Buettner <kevinb@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Require Python 3.4
2024-10-16 16:00 [PATCH] Require Python 3.4 Tom Tromey
2024-10-16 18:24 ` Eli Zaretskii
2024-10-23 22:38 ` Kevin Buettner
@ 2024-10-24 12:11 ` Tom de Vries
2 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2024-10-24 12:11 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On 10/16/24 18:00, Tom Tromey 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.
Perhaps a good idea to reference PR31870 " [gdb/python, meta] Minimum
supported python version" (
https://sourceware.org/bugzilla/show_bug.cgi?id=31870 ).
Acked-By: Tom de Vries <tdevries@suse.de>
Thanks,
- Tom
> ---
> gdb/NEWS | 2 ++
> gdb/README | 2 +-
> gdb/configure | 4 ++--
> gdb/configure.ac | 4 ++--
> gdb/doc/gdb.texinfo | 2 +-
> gdb/python/py-gdb-readline.c | 4 ----
> gdb/python/python-internal.h | 13 ++-----------
> 7 files changed, 10 insertions(+), 21 deletions(-)
>
> diff --git a/gdb/NEWS b/gdb/NEWS
> index 42668cbc057..544e805915e 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -51,6 +51,8 @@
>
> * Python API
>
> + ** GDB no longer supports Python versions less than 3.4.
> +
> ** Added gdb.record.clear. Clears the trace data of the current recording.
> This forces re-decoding of the trace for successive commands.
>
> diff --git a/gdb/README b/gdb/README
> index d85c37d5d17..e3bfda45da1 100644
> --- a/gdb/README
> +++ b/gdb/README
> @@ -516,7 +516,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 ec9bbd3a842..e3e9d1c8ec7 100755
> --- a/gdb/configure
> +++ b/gdb/configure
> @@ -28157,8 +28157,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 21f5dc8dd30..250b014e56c 100644
> --- a/gdb/configure.ac
> +++ b/gdb/configure.ac
> @@ -734,8 +734,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 554608da9fd..e12104867c4 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -41182,7 +41182,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/py-gdb-readline.c b/gdb/python/py-gdb-readline.c
> index dd0ee45fe2e..d8782a9ff33 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 d723c4d577b..d3337de9043 100644
> --- a/gdb/python/python-internal.h
> +++ b/gdb/python/python-internal.h
> @@ -87,6 +87,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
> @@ -134,17 +136,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>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-24 12:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-16 16:00 [PATCH] Require Python 3.4 Tom Tromey
2024-10-16 18:24 ` Eli Zaretskii
2024-10-23 22:38 ` Kevin Buettner
2024-10-24 12:11 ` Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox