Message169583
Here is what I think the test case should look like (untested):
static PyObject *
memoryview_from_buffer_cleanup(PyObject *self, PyObject *noargs)
{
PyObject *b, *view = NULL;
Py_buffer info;
Py_ssize_t shape[3] = {2, 2, 3};
Py_ssize_t strides[3] = {6, 3, 1};
const char *cp = "abcdefghijkl";
b = PyBytes_FromString(cp);
if (b == NULL)
return NULL;
if (PyObject_GetBuffer(b, &info, PyBUF_FULL_RO) < 0)
goto done;
/* reshape */
info.ndim = 3;
info.shape = shape;
info.strides = strides;
view = PyMemoryView_FromBuffer(&info);
/* release resources allocated for Py_buffer struct
before it goes out of scope */
PyBuffer_Release(&info);
done:
Py_DECREF(b);
return view;
} |
|
Date |
User |
Action |
Args |
2012-08-31 21:06:10 | belopolsky | set | recipients:
+ belopolsky, ncoghlan, pitrou, skrah, Alexander.Belopolsky, docs@python |
2012-08-31 21:06:10 | belopolsky | set | messageid: <1346447170.51.0.944082632726.issue15821@psf.upfronthosting.co.za> |
2012-08-31 21:06:09 | belopolsky | link | issue15821 messages |
2012-08-31 21:06:08 | belopolsky | create | |
|