Alexander Belopolsky added the comment: 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; } ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15821> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com