diff options
author | Tom Tromey <tromey@adacore.com> | 2024-10-16 09:58:14 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2025-05-30 07:09:53 -0600 |
commit | d61186d8f8ebfe85e4823d4ac3f8db91db52869a (patch) | |
tree | 2efcdeb4136d6096bd71b84703c5b6464e7a768c | |
parent | 429fb15134cfbdafe2b203086ee05d827726b63b (diff) | |
download | gdb-d61186d8f8ebfe85e4823d4ac3f8db91db52869a.zip gdb-d61186d8f8ebfe85e4823d4ac3f8db91db52869a.tar.gz gdb-d61186d8f8ebfe85e4823d4ac3f8db91db52869a.tar.bz2 |
Require Python 3.4
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
-rw-r--r-- | gdb/NEWS | 2 | ||||
-rw-r--r-- | gdb/README | 2 | ||||
-rwxr-xr-x | gdb/configure | 4 | ||||
-rw-r--r-- | gdb/configure.ac | 4 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 2 | ||||
-rw-r--r-- | gdb/python/lib/gdb/__init__.py | 7 | ||||
-rw-r--r-- | gdb/python/py-gdb-readline.c | 4 | ||||
-rw-r--r-- | gdb/python/python-internal.h | 13 |
8 files changed, 11 insertions, 27 deletions
@@ -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 @@ -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 683fcae..b34f666 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 052d031..9529e85 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 05f5502..2676471 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 69c15b1..03eb426 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 ea3a385..70ceebb 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 5262d76..bdccb26 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> |