This is the mail archive of the
gdb-testers@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix PR python/17386 - add __index__ method to gdb.Value
- From: sergiodj+buildbot at sergiodj dot net
- To: gdb-testers at sourceware dot org
- Date: Tue, 24 May 2016 12:33:48 -0400
- Subject: [binutils-gdb] Fix PR python/17386 - add __index__ method to gdb.Value
- Authentication-results: sourceware.org; auth=none
*** TEST RESULTS FOR COMMIT ddae946278bf4269370f7d945732485ad13469fa ***
Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: ddae946278bf4269370f7d945732485ad13469fa
Fix PR python/17386 - add __index__ method to gdb.Value
This patch fixes PR python/17386.
The bug is that gdb.Value does not implement the Python __index__
method. This method is needed to convert a Python object to an index
and is used by various operations in Python, such as indexing an
array.
The fix is to implement the nb_index method for gdb.Value.
nb_index was added in Python 2.5. I don't have a good way to test
Python 2.4, but I made an attempt to accomodate it.
I chose to use valpy_long in all cases because this simplifies porting
to Python 3, and because there didn't seem to be any harm.
Built and regtested on x86-64 Fedora 23.
2016-05-24 Tom Tromey <tom@tromey.com>
PR python/17386:
* python/py-value.c (value_object_as_number): Add
nb_inplace_floor_divide, nb_inplace_true_divide, nb_index.
2016-05-24 Tom Tromey <tom@tromey.com>
PR python/17386:
* gdb.python/py-value.exp (test_value_numeric_ops): Add tests that
use value as an index.
- Follow-Ups:
- *** COMPILATION FAILED *** Failures on AIX-POWER7-plain, branch master *** BREAKAGE ***
- Failures on RHEL-s390x-m64, branch master
- Failures on Fedora-x86_64-native-extended-gdbserver-m32, branch master
- Failures on Fedora-x86_64-cc-with-index, branch master
- Failures on Fedora-x86_64-m64, branch master
- Failures on Debian-i686-native-extended-gdbserver, branch master
- Failures on Debian-i686, branch master
- Failures on Debian-s390x-native-gdbserver-m64, branch master
- Failures on Fedora-ppc64be-native-gdbserver-m64, branch master
- Failures on Fedora-ppc64be-native-extended-gdbserver-m64, branch master
- Failures on Fedora-ppc64le-native-extended-gdbserver-m64, branch master