This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients jcon, kristjan.jonsson, mark.dickinson, ncoghlan, paul.moore, petri.lehtinen, pitrou, pv, rupole, skrah, teoliphant, vstinner
Date 2012-01-17.11:53:18
SpamBayes Score 0.0
Marked as misclassified No
Message-id <20120117115317.GA9679@sleipnir.bytereef.org>
In-reply-to <1326720225.98.0.599117190399.issue10181@psf.upfronthosting.co.za>
Content
Thanks for the comments. Most of them should be easy to fix.

Nick Coghlan <report@bugs.python.org> wrote:
> [...] expose the Py_buffer len field as "memoryview.size" instead of
> "memoryview.len" (to reduce confusion with "len(memoryview)" and
> to encourage a conceptual link with sys.getsizeof()).

I agree with this. The best thing is probably to have both versions
work in 3.3 and remove memoryview.len in 3.4 (or later).

> As noted in the review, I also think fixing #12384 should be fairly
> straightforward and it would be nice to have that working when the
> change is applied.

tobytes() currently calls PyBuffer_ToContiguous(..., 'C') from
Objects/abstract.c. Since the function repeatedly calls
PyBuffer_GetPointer(), it has this comment:

    /* XXX : This is not going to be the fastest code in the world
             several optimizations are possible.
     */

So if the fix for tobytes() should go in, I'd like to use the
copy_buffer() function from _testbuffer.c. PyBuffer_ToContiguous()
would need to be fixed separately.

test_buffer.py already asserts that for each result, result.tolist()
and result.tobytes() match the results obtained from PyBuffer_GetPointer(indices)
(See: test_buffer.py:779), so I'm not worried about using the same
implementation in the tests as in the production code.
History
Date User Action Args
2012-01-17 11:53:19skrahsetrecipients: + skrah, teoliphant, paul.moore, mark.dickinson, ncoghlan, rupole, pitrou, kristjan.jonsson, vstinner, pv, jcon, petri.lehtinen
2012-01-17 11:53:19skrahlinkissue10181 messages
2012-01-17 11:53:18skrahcreate