Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Require Python 3.4
Date: Thu, 24 Oct 2024 14:11:14 +0200	[thread overview]
Message-ID: <4ab8631d-751d-43e6-ae33-8551f61c0b7c@suse.de> (raw)
In-Reply-To: <20241016160000.219628-1-tromey@adacore.com>

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>


      parent reply	other threads:[~2024-10-24 12:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16 16:00 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 message]

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=4ab8631d-751d-43e6-ae33-8551f61c0b7c@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.com \
    /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: link
Be 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