From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id a2GiJSHjD2dzBhAAWB0awg (envelope-from ) for ; Wed, 16 Oct 2024 12:00:33 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=G1Kxzie4; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 81EB71E357; Wed, 16 Oct 2024 12:00:33 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,URIBL_BLOCKED,URIBL_DBL_BLOCKED_OPENDNS autolearn=ham autolearn_force=no version=4.0.0 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 7CB2B1E0C0 for ; Wed, 16 Oct 2024 12:00:32 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 095423858405 for ; Wed, 16 Oct 2024 16:00:32 +0000 (GMT) Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by sourceware.org (Postfix) with ESMTPS id 224CA3858D20 for ; Wed, 16 Oct 2024 16:00:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 224CA3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 224CA3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::12e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729094411; cv=none; b=wfK4vLegmdpZVTjoIpuFPhlZVoWQmSRo9SygNTKXN2OfnhniazzchDH2wd/RZ9RGQrQGmaAagUTTPiJuCJUjzgslzMY+tQWPi597GhkQ4Gk6ICkUbi3/SC6KOXog2rW/J6EGR76Afaf+h3QurgkLpauYHZnbTIBBKQEG6xtf4Fw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729094411; c=relaxed/simple; bh=OEYs3OUXxrTYis0LSCD7Il1lnLPkIUClxlmg4II4p8A=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=v6xPz9JOHgYabtC80tWHLP09YvLg9YuFA0zMCMHGaWOfbEWLwOkU8Y8FpBxkz3FsfZ/9GMgdYs+t1lEcFbPFym8ZJLfFMo+WCM4L3K+EYVo2PhdnzI2HrrlqTuDYu2scfDRXFAKd8ozfc08EKe+22OlO7DWJeofJzBG+OHCs9DM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-3a3b2499c65so176985ab.0 for ; Wed, 16 Oct 2024 09:00:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1729094408; x=1729699208; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=bnAzsV54OyjKQz4p4lSGm7pFgBxLq01QahPrbcKg7zE=; b=G1Kxzie4Yrcp25cNbwLGQduWKilDjr99amfjKVyAlB00hYUOk7d5K2MSVgmBb2TUGI D9zDY8TryR/GaD4FS7MVk61Y55aRpe7rpF8DYgIBFIdZzMxkvPiaTUm7Kz4d1Wl+G5l6 dUek67s+mvgcKPPgnJpXdoUBTQ9/BhUaPUAPJTMjDzXKgsCq3i+qhZhPybjdACjWMN88 N91zsHIak8sufkHm0dzGMCgkchvrnz6RN1ntynJSosLHF3hVm4/xLp6QJ+FYLdx9Rj+Z swot96O+YFaCKtc7wlK8Ijk3/C6G//mC7S2M5lzEai+3NNOt0R2TGgHBTj9FUadl4/4O xi9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729094408; x=1729699208; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bnAzsV54OyjKQz4p4lSGm7pFgBxLq01QahPrbcKg7zE=; b=MpUVwPySsVds8Oc9XT4eQbPte/k+XrDF+zLMciQDPJiVLkKZOisTFj8Gu3IZoeRC7E Bgm0AP1jxBni4VxqcafUp+VrBEc0RwAHZqOOnPXjmvIW6S3CHtVuFkS24w+bespNxlQz rSpFq/+48Ep5YkE6FNVcuXdZchIVYX6+cjbRiAGgbsAYjCF6A2Ts1LuOaHt5Q2NVwWSU oHfHBoNBDqtkJxh7n398oBS0ywGzcmyXjhcZlNICnjb/NHD/2pZ4WyA61WK0oe0hs6DE d8rMR3c8TgtY/yv5BwCoL6yxz02EbL4FVjLyMGWdth6Bfjs15IrmYvaukGwqNCf8qg4m Bnew== X-Gm-Message-State: AOJu0YxuCPL6d6RafMnpjyP+1aV1SDcZXTkKG5Mace1cR3pgq7ZXBfy0 jjGu+XpYhajto3vui+e9oQyZpnMNwqogeB61SVKMzTk/Ao5AJ/ZKTchEmAbm/VLtz+MCor2ohnQ = X-Google-Smtp-Source: AGHT+IEq6jNC29pgY2MyKiv1lYU4AdxLomuHSdInUcfwm3cCiy6VEBj3jdRTv6L5OustHHZJBJ+Odw== X-Received: by 2002:a05:6e02:1446:b0:3a0:aa6c:8a51 with SMTP id e9e14a558f8ab-3a3dc4a5dbbmr48564985ab.8.1729094408147; Wed, 16 Oct 2024 09:00:08 -0700 (PDT) Received: from localhost.localdomain (97-122-113-155.hlrn.qwest.net. [97.122.113.155]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a3d7074916sm8659845ab.8.2024.10.16.09.00.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 09:00:07 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Require Python 3.4 Date: Wed, 16 Oct 2024 10:00:00 -0600 Message-ID: <20241016160000.219628-1-tromey@adacore.com> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org 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 #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 -- 2.47.0