➜

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.

作者 belopolsky
收信人 Alexander.Belopolsky, belopolsky, docs@python, ncoghlan, pitrou, skrah
日期 2012-08-31.21:06:08
SpamBayes Score -1.0
Marked as misclassified 是
Message-id <1346447170.51.0.944082632726.issue15821@psf.upfronthosting.co.za>
In-reply-to
内容
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;
}
历史
日期 用户 动作 参数
2012-08-31 21:06:10belopolsky修改recipients: + belopolsky, ncoghlan, pitrou, skrah, Alexander.Belopolsky, docs@python
2012-08-31 21:06:10belopolsky修改messageid: <1346447170.51.0.944082632726.issue15821@psf.upfronthosting.co.za>
2012-08-31 21:06:09belopolsky链接issue15821 messages
2012-08-31 21:06:08belopolsky创建