[RFC] Bump minimum Python version to 3.4

Message ID 20230602163303.3945535-1-tromey@adacore.com
State New
Headers
Series [RFC] Bump minimum Python version to 3.4 |

Commit Message

Tom Tromey June 2, 2023, 4:33 p.m. UTC
  While looking into the f-string issue, I noticed that the README
documents 3.2 as the minimum Python version, while gdb.texinfo says
3.0.2.  Asking on irc, I found out that SuSE's "LTS" ships 3.4, and
RHEL 7 ships 3.6.  Based on this I think it's reasonable to bump the
minimum required version to 3.4.
---
 gdb/NEWS                     |  2 ++
 gdb/README                   |  2 +-
 gdb/doc/gdb.texinfo          |  2 +-
 gdb/python/py-gdb-readline.c |  4 ----
 gdb/python/python-internal.h | 11 -----------
 5 files changed, 4 insertions(+), 17 deletions(-)
  

Comments

Simon Marchi June 2, 2023, 6:01 p.m. UTC | #1
On 6/2/23 12:33, Tom Tromey via Gdb-patches wrote:
> While looking into the f-string issue, I noticed that the README
> documents 3.2 as the minimum Python version, while gdb.texinfo says
> 3.0.2.  Asking on irc, I found out that SuSE's "LTS" ships 3.4, and
> RHEL 7 ships 3.6.  Based on this I think it's reasonable to bump the
> minimum required version to 3.4.

This is fine with me, but for reference here's the previous attempt at
doing this:

https://inbox.sourceware.org/gdb-patches/20220107152921.2858909-3-simon.marchi@polymtl.ca/#r

Simon
  
Eli Zaretskii June 2, 2023, 6:14 p.m. UTC | #2
> Cc: legouguec@adacore.com,
> 	Tom Tromey <tromey@adacore.com>
> Date: Fri,  2 Jun 2023 10:33:03 -0600
> From: Tom Tromey via Gdb-patches <gdb-patches@sourceware.org>
> 
> While looking into the f-string issue, I noticed that the README
> documents 3.2 as the minimum Python version, while gdb.texinfo says
> 3.0.2.  Asking on irc, I found out that SuSE's "LTS" ships 3.4, and
> RHEL 7 ships 3.6.  Based on this I think it's reasonable to bump the
> minimum required version to 3.4.
> ---
>  gdb/NEWS                     |  2 ++
>  gdb/README                   |  2 +-
>  gdb/doc/gdb.texinfo          |  2 +-
>  gdb/python/py-gdb-readline.c |  4 ----
>  gdb/python/python-internal.h | 11 -----------
>  5 files changed, 4 insertions(+), 17 deletions(-)

If the increase in the minimum supported versions is agreed upon, the
documentation parts of this are OK.

Thanks.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
  
Paul Koning June 2, 2023, 6:20 p.m. UTC | #3
> On Jun 2, 2023, at 2:14 PM, Eli Zaretskii via Gdb-patches <gdb-patches@sourceware.org> wrote:
> 
>> Cc: legouguec@adacore.com,
>> 	Tom Tromey <tromey@adacore.com>
>> Date: Fri,  2 Jun 2023 10:33:03 -0600
>> From: Tom Tromey via Gdb-patches <gdb-patches@sourceware.org>
>> 
>> While looking into the f-string issue, I noticed that the README
>> documents 3.2 as the minimum Python version, while gdb.texinfo says
>> 3.0.2.  Asking on irc, I found out that SuSE's "LTS" ships 3.4, and
>> RHEL 7 ships 3.6.  Based on this I think it's reasonable to bump the
>> minimum required version to 3.4.
>> ---
>> gdb/NEWS                     |  2 ++
>> gdb/README                   |  2 +-
>> gdb/doc/gdb.texinfo          |  2 +-
>> gdb/python/py-gdb-readline.c |  4 ----
>> gdb/python/python-internal.h | 11 -----------
>> 5 files changed, 4 insertions(+), 17 deletions(-)
> 
> If the increase in the minimum supported versions is agreed upon, the
> documentation parts of this are OK.

Given that python.org tells us the oldest supported version is 3.6, and that one goes off support at the end of this month, it might make sense to raise the minimum to 3.6 or 3.7.

	paul
  
Eli Zaretskii June 2, 2023, 6:42 p.m. UTC | #4
> From: Paul Koning <paulkoning@comcast.net>
> Date: Fri, 2 Jun 2023 14:20:29 -0400
> Cc: Tom Tromey <tromey@adacore.com>,
>  gdb-patches@sourceware.org,
>  legouguec@adacore.com
> 
> > On Jun 2, 2023, at 2:14 PM, Eli Zaretskii via Gdb-patches <gdb-patches@sourceware.org> wrote:
> > 
> >> Cc: legouguec@adacore.com,
> >> 	Tom Tromey <tromey@adacore.com>
> >> Date: Fri,  2 Jun 2023 10:33:03 -0600
> >> From: Tom Tromey via Gdb-patches <gdb-patches@sourceware.org>
> >> 
> >> While looking into the f-string issue, I noticed that the README
> >> documents 3.2 as the minimum Python version, while gdb.texinfo says
> >> 3.0.2.  Asking on irc, I found out that SuSE's "LTS" ships 3.4, and
> >> RHEL 7 ships 3.6.  Based on this I think it's reasonable to bump the
> >> minimum required version to 3.4.
> >> ---
> >> gdb/NEWS                     |  2 ++
> >> gdb/README                   |  2 +-
> >> gdb/doc/gdb.texinfo          |  2 +-
> >> gdb/python/py-gdb-readline.c |  4 ----
> >> gdb/python/python-internal.h | 11 -----------
> >> 5 files changed, 4 insertions(+), 17 deletions(-)
> > 
> > If the increase in the minimum supported versions is agreed upon, the
> > documentation parts of this are OK.
> 
> Given that python.org tells us the oldest supported version is 3.6, and that one goes off support at the end of this month, it might make sense to raise the minimum to 3.6 or 3.7.

To that, I'd object: it means, effectively, to drop support for
Windows XP, where the last Python version is 3.4.4.

We, as part of the GNU project, have no obligation to follow the
recommendations of python.org.  We should make our own decisions,
based on our goals.
  
Kevin Buettner June 3, 2023, 12:01 a.m. UTC | #5
On Fri,  2 Jun 2023 10:33:03 -0600
Tom Tromey via Gdb-patches <gdb-patches@sourceware.org> wrote:

> While looking into the f-string issue, I noticed that the README
> documents 3.2 as the minimum Python version, while gdb.texinfo says
> 3.0.2.  Asking on irc, I found out that SuSE's "LTS" ships 3.4, and
> RHEL 7 ships 3.6.  Based on this I think it's reasonable to bump the
> minimum required version to 3.4.

I'm in favor of this change.

The patch LGTM also.

Kevin
  
Andrew Burgess June 7, 2023, 9:41 a.m. UTC | #6
Tom Tromey via Gdb-patches <gdb-patches@sourceware.org> writes:

> While looking into the f-string issue, I noticed that the README
> documents 3.2 as the minimum Python version, while gdb.texinfo says
> 3.0.2.  Asking on irc, I found out that SuSE's "LTS" ships 3.4, and
> RHEL 7 ships 3.6.  Based on this I think it's reasonable to bump the
> minimum required version to 3.4.

No objections from me.

Thanks,
Andrew


> ---
>  gdb/NEWS                     |  2 ++
>  gdb/README                   |  2 +-
>  gdb/doc/gdb.texinfo          |  2 +-
>  gdb/python/py-gdb-readline.c |  4 ----
>  gdb/python/python-internal.h | 11 -----------
>  5 files changed, 4 insertions(+), 17 deletions(-)
>
> diff --git a/gdb/NEWS b/gdb/NEWS
> index 649a3a9824a..4a8f51c06c3 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -3,6 +3,8 @@
>  
>  *** Changes since GDB 13
>  
> +* The minimum supported version of Python is now 3.4.
> +
>  * The AArch64 'org.gnu.gdb.aarch64.pauth' Pointer Authentication feature string
>    has been deprecated in favor of the 'org.gnu.gdb.aarch64.pauth_v2' feature
>    string.
> diff --git a/gdb/README b/gdb/README
> index 9699f4890c6..527aa5ff27c 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/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index fc55c4e7b43..09adce80e85 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -40421,7 +40421,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 124cec8055d..698f6cad038 100644
> --- a/gdb/python/py-gdb-readline.c
> +++ b/gdb/python/py-gdb-readline.c
> @@ -30,11 +30,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 93217375cc5..83fb9b79453 100644
> --- a/gdb/python/python-internal.h
> +++ b/gdb/python/python-internal.h
> @@ -123,17 +123,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
> -
>  /* PyObject_CallMethod's 'method' and 'format' parameters were missing
>     the 'const' qualifier before Python 3.4.  Hence, we wrap the
>     function in our own version to avoid errors with string literals.
> -- 
> 2.40.0
  

Patch

diff --git a/gdb/NEWS b/gdb/NEWS
index 649a3a9824a..4a8f51c06c3 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,8 @@ 
 
 *** Changes since GDB 13
 
+* The minimum supported version of Python is now 3.4.
+
 * The AArch64 'org.gnu.gdb.aarch64.pauth' Pointer Authentication feature string
   has been deprecated in favor of the 'org.gnu.gdb.aarch64.pauth_v2' feature
   string.
diff --git a/gdb/README b/gdb/README
index 9699f4890c6..527aa5ff27c 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/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index fc55c4e7b43..09adce80e85 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -40421,7 +40421,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 124cec8055d..698f6cad038 100644
--- a/gdb/python/py-gdb-readline.c
+++ b/gdb/python/py-gdb-readline.c
@@ -30,11 +30,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 93217375cc5..83fb9b79453 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -123,17 +123,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
-
 /* PyObject_CallMethod's 'method' and 'format' parameters were missing
    the 'const' qualifier before Python 3.4.  Hence, we wrap the
    function in our own version to avoid errors with string literals.