This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: MemoryView missing from Python 2.4 and 2.6
- From: Joel Brobecker <brobecker at adacore dot com>
- To: "Wiederhake, Tim" <tim dot wiederhake at intel dot com>
- Cc: "Jose E. Marchesi" <jose dot marchesi at oracle dot com>, Yao Qi <qiyaoltc at gmail dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 7 Mar 2017 10:27:49 -0500
- Subject: Re: MemoryView missing from Python 2.4 and 2.6
- Authentication-results: sourceware.org; auth=none
- References: <87o9xsx38r.fsf@oracle.com> <20170223225946.snir4ab6twc7vo7n@localhost> <9676A094AF46E14E8265E7A3F4CCE9AF9417D1@irsmsx105.ger.corp.intel.com> <86h93j7evn.fsf@gmail.com> <9676A094AF46E14E8265E7A3F4CCE9AF941DE1@irsmsx105.ger.corp.intel.com> <87wpca8onq.fsf@oracle.com> <20170307002119.ri3xv4cfxfkrb4gm@adacore.com> <9676A094AF46E14E8265E7A3F4CCE9AF9428CB@irsmsx105.ger.corp.intel.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 here anyway.
>
> 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.
OK, that seems sensible for me indeed. Thanks for taking the time
to explain!
--
Joel