public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb/python] Note that python 3.6 assumes long long support
@ 2024-06-09  8:37 Tom de Vries
  2024-06-10 14:36 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2024-06-09  8:37 UTC (permalink / raw)
  To: gdb-patches

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.

[1] https://github.com/python/cpython/issues/72148
---
 gdb/python/python-internal.h | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 5132ec15ba6..3c450560b9f 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
 

base-commit: e222ed2ce5b5359bfc6d8fd125534ccb507d7fb0
-- 
2.35.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] [gdb/python] Note that python 3.6 assumes long long support
  2024-06-09  8:37 [PATCH] [gdb/python] Note that python 3.6 assumes long long support Tom de Vries
@ 2024-06-10 14:36 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2024-06-10 14:36 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> Starting with python 3.6, support for platforms without long long support
Tom> has been removed [1].

Tom> HAVE_LONG_LONG and PY_LONG_LONG are still defined, but only for compatibility,
Tom> so stop relying on them.

Thanks for doing this.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-10 14:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-09  8:37 [PATCH] [gdb/python] Note that python 3.6 assumes long long support Tom de Vries
2024-06-10 14:36 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).