From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org, Paul_Koning@dell.com
Subject: [patchv2] Fix Python 3 build error on 32-bit hosts
Date: Wed, 04 Feb 2015 19:20:00 -0000 [thread overview]
Message-ID: <20150204192028.GA12310@host1.jankratochvil.net> (raw)
In-Reply-To: <54D26BCA.2000505@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]
On Wed, 04 Feb 2015 19:58:18 +0100, Pedro Alves wrote:
> I agree with Paul here. I think checking Python version is sufficient.
I should point out that version checking is error prone to distro backports.
> I'd be fine with providing a fallback Py_hash_t in python/python-internal.h,
> where we already do a series of fallback definitions and fixes for older
> Python, such as e.g. Py_ssize_t.
Done.
Jan
[-- Attachment #2: 1 --]
[-- Type: text/plain, Size: 1238 bytes --]
gdb/
2015-02-04 Jan Kratochvil <jan.kratochvil@redhat.com>
* python/python-internal.h (Py_hash_t): Define it for Python <3.2.
* python/py-value.c (valpy_fetch_lazy): Use it. Remove cast to the
return type.
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 0ee8544..23d4755 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -169,6 +169,10 @@ typedef unsigned long gdb_py_ulongest;
#endif /* HAVE_LONG_LONG */
+#if PY_VERSION_HEX < 0x03020000
+typedef long Py_hash_t;
+#endif
+
/* Python 2.6 did not wrap Py_DECREF in 'do {...} while (0)', leading
to 'suggest explicit braces to avoid ambiguous ‘else’' gcc errors.
Wrap it ourselves, so that callers don't need to care. */
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index 4c4d36e..5a13777 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -895,10 +895,10 @@ valpy_fetch_lazy (PyObject *self, PyObject *args)
/* Calculate and return the address of the PyObject as the value of
the builtin __hash__ call. */
-static long
+static Py_hash_t
valpy_hash (PyObject *self)
{
- return (long) (intptr_t) self;
+ return (intptr_t) self;
}
enum valpy_opcode
next prev parent reply other threads:[~2015-02-04 19:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-04 17:43 [patch] " Jan Kratochvil
2015-02-04 18:39 ` Paul_Koning
2015-02-04 18:58 ` Pedro Alves
2015-02-04 19:08 ` Pedro Alves
2015-02-04 19:20 ` Jan Kratochvil [this message]
2015-02-04 19:27 ` [patchv2] " Pedro Alves
2015-02-04 19:34 ` [commit] " Jan Kratochvil
2015-02-04 19:42 ` Pedro Alves
2015-02-04 19:51 ` Phil Muldoon
2015-02-04 21:06 ` Paul_Koning
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150204192028.GA12310@host1.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=Paul_Koning@dell.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox