diff options
author | Phil Muldoon <pmuldoon@redhat.com> | 2010-05-14 11:11:28 +0000 |
---|---|---|
committer | Phil Muldoon <pmuldoon@redhat.com> | 2010-05-14 11:11:28 +0000 |
commit | 88d4aea7473bf93d98ba72a5f955f428cd365431 (patch) | |
tree | e69d248568991dfb44daad47c0c6ee6b8e8ea084 /gdb/python/py-value.c | |
parent | af47dcbf0d148aba27ced058d6bfb83fd282b5c9 (diff) | |
download | gdb-88d4aea7473bf93d98ba72a5f955f428cd365431.zip gdb-88d4aea7473bf93d98ba72a5f955f428cd365431.tar.gz gdb-88d4aea7473bf93d98ba72a5f955f428cd365431.tar.bz2 |
2010-05-14 Phil Muldoon <pmuldoon@redhat.com>
PR python/11482
* python/py-value.c (valpy_hash): New function.
(value_object_type): Register valpy_hash.
2010-05-14 Phil Muldoon <pmuldoon@redhat.com>
PR python/11482
* gdb.python/py-value.exp (test_value_hash): New function
Diffstat (limited to 'gdb/python/py-value.c')
-rw-r--r-- | gdb/python/py-value.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index 173b3c9..abf50ff 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -432,6 +432,14 @@ valpy_get_is_optimized_out (PyObject *self, void *closure) Py_RETURN_FALSE; } +/* Calculate and return the address of the PyObject as the value of + the builtin __hash__ call. */ +static long +valpy_hash (PyObject *self) +{ + return (long) (intptr_t) self; +} + enum valpy_opcode { VALPY_ADD, @@ -1097,7 +1105,7 @@ PyTypeObject value_object_type = { &value_object_as_number, /*tp_as_number*/ 0, /*tp_as_sequence*/ &value_object_as_mapping, /*tp_as_mapping*/ - 0, /*tp_hash */ + valpy_hash, /*tp_hash*/ 0, /*tp_call*/ valpy_str, /*tp_str*/ 0, /*tp_getattro*/ |