Message235276
| Author |
skrah |
| Recipients |
larry, serhiy.storchaka, skrah, vstinner |
| Date |
2015年02月02日.17:29:19 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<20150202172907.GA32275@bytereef.org> |
| In-reply-to |
<CAMpsgwZyRMeA1WB-WkYpfkR21hziU6V5AZYyueo+O2m8iJkFLg@mail.gmail.com> |
| Content |
STINNER Victor wrote:
> I don't understand the link between third party extensions and
> test_getargs2. test_getargs2 is a unit test for non-regression of
> CPython. Can you please elaborate?
A test failure needs a broken buffer provider that hands out a non-contiguous
buffer in response to a PyBUF_SIMPLE request.
The only non-contiguous buffer provider in the stdlib is memoryview.
If I break memoryview's getbufferproc ...
diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c
--- a/Objects/memoryobject.c
+++ b/Objects/memoryobject.c
@@ -1465,11 +1465,6 @@
return -1;
}
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;
}
if (!REQ_SHAPE(flags)) {
...
test_buffer already fails. So what should I test? Perhaps ctypes has
some capabilities that I'm unaware of.
If I'm using _testbuffer.ndarray(), I'm effectively testing that the
getbufferproc of ndarray is correct (which is also tested multiple times
in test_buffer). |
|