homepage

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 vstinner
Recipients larry, martin.panter, methane, python-dev, serhiy.storchaka, vstinner
Date 2017年02月02日.13:34:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1486042491.68.0.227427220935.issue29300@psf.upfronthosting.co.za>
In-reply-to
Content
Martin Panter: """FYI Victor, you can make non-C-contiguous buffers by slicing memoryview:
>>> struct.unpack(">L", memoryview(b"1234")[::-1])
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
BufferError: memoryview: underlying buffer is not C-contiguous"""
Oh, it means that the Argument Clinic change doesn't add new checks on the buffer? In Python 3.6, memory_getbuf() raises an exception in the following code:
 if (!REQ_STRIDES(flags)) {
 if (!MV_C_CONTIGUOUS(baseflags)) {
 PyErr_SetString(PyExc_BufferError,
 "memoryview: underlying buffer is not C-contiguous");
 return -1;
 }
 view->strides = NULL;
 }
I undersrtand that memory_getbuf() is smart enough to raise an exception becaues the buffer is not contiguous. But a weaker implementation of getbuffer may not implement such check, whereas getbuffer() double check that the buffer is C-contiguous. Am I right?
History
Date User Action Args
2017年02月02日 13:34:51vstinnersetrecipients: + vstinner, larry, methane, python-dev, martin.panter, serhiy.storchaka
2017年02月02日 13:34:51vstinnersetmessageid: <1486042491.68.0.227427220935.issue29300@psf.upfronthosting.co.za>
2017年02月02日 13:34:51vstinnerlinkissue29300 messages
2017年02月02日 13:34:51vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /