]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Require Python 3.4
authorTom Tromey <tromey@adacore.com>
Wed, 16 Oct 2024 15:58:14 +0000 (09:58 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 30 May 2025 13:09:53 +0000 (07:09 -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
gdb/README
gdb/configure
gdb/configure.ac
gdb/doc/gdb.texinfo
gdb/python/lib/gdb/__init__.py
gdb/python/py-gdb-readline.c
gdb/python/python-internal.h

index 2e48a00df5a44cfcc776fbd819cccbe97549ff69..970a527a64cde36ccfbd66bd3fa9f853ae911421 100644 (file)
--- 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
index 5a0030511d61a4314830ec7d2ce546307780769b..3c42936b67962f86222a11de7c6ddf7095be3f8b 100644 (file)
@@ -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.
index 683fcaef9fe47089204644741e136ba70eb0d9d5..b34f66679e8e3c47a36358d5b7c636c15d5c2a1d 100755 (executable)
@@ -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 ();
 
index 052d0319a044c092aadeb2a89884d21adeedfae2..9529e850154f780b98c4966363246a25fe4fbda5 100644 (file)
@@ -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 ();
                                 ]])],
index 05f550233fe2f2925859f9301b8e24acb75172a7..267647108dda829b885d1ea29fb8c6dffa7ba950 100644 (file)
@@ -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.
index 69c15b16d87b838a4e5e16ba15d311f387bb5834..03eb426b66243b4b16f9dffc1f50b8df6e524897 100644 (file)
@@ -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
 
index ea3a3850312d2699a4d2c2087fd2e7486386a677..70ceebb36a14dc317c0070e7dde608588844b934 100644 (file)
 
 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;
index 5262d7675290b1f5c8535686e8746a89aec23b5f..bdccb265441e7f7fb3382abc7736b30b0a6dadf2 100644 (file)
@@ -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>