aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-06-10 16:52:06 +0200
committerTom de Vries <tdevries@suse.de>2024-06-10 16:52:06 +0200
commita8463c6844cf238684bff035ececf1aaeef6135c (patch)
treede43ee18e322da78db65eb61ddb709897089d3b1
parent539c3962fa08cfe46f71555f6b6d47326f3d9cda (diff)
downloadgdb-a8463c6844cf238684bff035ececf1aaeef6135c.zip
gdb-a8463c6844cf238684bff035ececf1aaeef6135c.tar.gz
gdb-a8463c6844cf238684bff035ececf1aaeef6135c.tar.bz2
[gdb/python] Note that python 3.6 assumes long long support
Starting with python 3.6, support for platforms without long long support has been removed [1]. HAVE_LONG_LONG and PY_LONG_LONG are still defined, but only for compatibility, so stop relying on them. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com> [1] https://github.com/python/cpython/issues/72148
-rw-r--r--gdb/python/python-internal.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 5132ec1..3c45056 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -102,13 +102,24 @@
/* Python supplies HAVE_LONG_LONG and some `long long' support when it
is available. These defines let us handle the differences more
- cleanly. */
-#ifdef HAVE_LONG_LONG
+ cleanly.
+
+ Starting with python 3.6, support for platforms without long long support
+ has been removed [1]. HAVE_LONG_LONG and PY_LONG_LONG are still defined,
+ but only for compatibility, so we no longer rely on them.
+
+ [1] https://github.com/python/cpython/issues/72148. */
+#if PY_VERSION_HEX >= 0x03060000 || defined (HAVE_LONG_LONG)
#define GDB_PY_LL_ARG "L"
#define GDB_PY_LLU_ARG "K"
+#if PY_VERSION_HEX >= 0x03060000
+typedef long long gdb_py_longest;
+typedef unsigned long long gdb_py_ulongest;
+#else
typedef PY_LONG_LONG gdb_py_longest;
typedef unsigned PY_LONG_LONG gdb_py_ulongest;
+#endif
#define gdb_py_long_as_ulongest PyLong_AsUnsignedLongLong
#define gdb_py_long_as_long_and_overflow PyLong_AsLongLongAndOverflow