diff options
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/python/py-value.c | 4 | ||||
-rw-r--r-- | gdb/python/python-internal.h | 4 |
3 files changed, 12 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index aae6a7c..cd1c9d7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +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. + 2015-02-04 Pedro Alves <palves@redhat.com> * linux-nat.c (handle_extended_wait): Don't resume LWPs here. 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 diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index 0ee8544..a77f5a6 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. */ |