This is the mail archive of the
mailing list for the GDB project.
RE: MemoryView missing from Python 2.4 and 2.6
- From: "Wiederhake, Tim" <tim dot wiederhake at intel dot com>
- To: Joel Brobecker <brobecker at adacore dot com>, "Jose E. Marchesi" <jose dot marchesi at oracle dot com>
- Cc: Yao Qi <qiyaoltc at gmail dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 7 Mar 2017 13:38:20 +0000
- Subject: RE: MemoryView missing from Python 2.4 and 2.6
- Authentication-results: sourceware.org; auth=none
- References: <firstname.lastname@example.org> <20170223225946.snir4ab6twc7vo7n@localhost> <9676A094AF46E14E8265E7A3F4CCE9AF9417D1@irsmsx105.ger.corp.intel.com> <email@example.com> <9676A094AF46E14E8265E7A3F4CCE9AF941DE1@irsmsx105.ger.corp.intel.com> <firstname.lastname@example.org> <email@example.com>
> It looks like the patch is also removing the feature from users of
> Python 2.7.x, though, is it not?
The patch (see https://sourceware.org/ml/gdb-patches/2017-03/msg00039.html)
does not remove any feature. The patch changes the return type of one function
from "memoryview" to "buffer" for Python 2.7 and below. Both types support the
"in" keyword, indexed access, length etc. and behave very similar. Granted,
memoryview has some additional functions that lets the user inspect the stride
and size of the elements in the buffer, but this is a feature we do not use
I chose 2.7 as a parting point because that is how it is handled in
infpy_read_memory in py-inferior.c. Personally, I would leave it that way
because with "buffer" exposed with Python 2.7 as well as Python 2.6 and below,
I guess it gets more exposure and testing and won't suffer bit-rot as easily.
The patch is tested with Python 2.7 and Python 3.6. I cannot test it with
Python 2.6 but that should not be necessary as these two versions already check
both different return types.
> -----Original Message-----
> From: Joel Brobecker [mailto:firstname.lastname@example.org]
> Sent: Tuesday, March 7, 2017 1:21 AM
> To: Jose E. Marchesi <email@example.com>
> Cc: Wiederhake, Tim <firstname.lastname@example.org>; Yao Qi
> <email@example.com>; firstname.lastname@example.org
> Subject: Re: MemoryView missing from Python 2.4 and 2.6
> > Jose, can you confirm that this patch un-breaks GDB linked with
> > Python 2.6?
> > Yep. This fixes the build with Python 2.6.6.
> It looks like the patch is also removing the feature from users of Python 2.7.x,
> though, is it not? Given that this is a new feature, this wouldn't be the end of
> the world, especially since we're so close to branching, so we wouldn't want
> that to be a reason to delay the fix too much longer. However, I think our
> configure script defines HAVE_LIBPYTHON2_7, so perhaps we could either
> use that, or explicitly exclude HAVE_LIBPYTHON2_6, HAVE_LIBPYTHON2_5
> and HAVE_LIBPYTHON2_4 instead of only including it for Python 3.x?
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928