mirror of https://github.com/python/cpython
Whitespace and line lengrth cleanup.
This commit is contained in:
parent
3f6d44e03e
commit
5dde61d0b9
|
@ -8,8 +8,8 @@ memory_getbuf(PyMemoryViewObject *self, Py_buffer *view, int flags)
|
||||||
{
|
{
|
||||||
if (view != NULL)
|
if (view != NULL)
|
||||||
*view = self->view;
|
*view = self->view;
|
||||||
return self->base->ob_type->tp_as_buffer->bf_getbuffer(self->base,
|
return self->base->ob_type->tp_as_buffer->bf_getbuffer(self->base, NULL,
|
||||||
NULL, PyBUF_FULL);
|
PyBUF_FULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -43,7 +43,7 @@ PyMemoryView_FromObject(PyObject *base)
|
||||||
|
|
||||||
if (!PyObject_CheckBuffer(base)) {
|
if (!PyObject_CheckBuffer(base)) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
"cannot make memory view because object does "\
|
"cannot make memory view because object does "
|
||||||
"not have the buffer interface");
|
"not have the buffer interface");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -240,8 +240,8 @@ PyMemoryView_GetContiguous(PyObject *obj, int buffertype, char fort)
|
||||||
if (buffertype == PyBUF_WRITE) {
|
if (buffertype == PyBUF_WRITE) {
|
||||||
PyObject_DEL(mem);
|
PyObject_DEL(mem);
|
||||||
PyErr_SetString(PyExc_BufferError,
|
PyErr_SetString(PyExc_BufferError,
|
||||||
"writable contiguous buffer requested for a non-contiguous" \
|
"writable contiguous buffer requested "
|
||||||
"object.");
|
"for a non-contiguousobject.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
bytes = PyBytes_FromStringAndSize(NULL, view->len);
|
bytes = PyBytes_FromStringAndSize(NULL, view->len);
|
||||||
|
@ -485,7 +485,8 @@ memory_subscript(PyMemoryViewObject *self, PyObject *key)
|
||||||
return (PyObject *)self;
|
return (PyObject *)self;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PyErr_SetString(PyExc_IndexError, "invalid indexing of 0-dim memory");
|
PyErr_SetString(PyExc_IndexError,
|
||||||
|
"invalid indexing of 0-dim memory");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -502,7 +503,9 @@ memory_subscript(PyMemoryViewObject *self, PyObject *key)
|
||||||
ptr += view->itemsize * result;
|
ptr += view->itemsize * result;
|
||||||
else
|
else
|
||||||
ptr += view->strides[0] * result;
|
ptr += view->strides[0] * result;
|
||||||
if (view->suboffsets != NULL && view->suboffsets[0] >= 0) {
|
if (view->suboffsets != NULL &&
|
||||||
|
view->suboffsets[0] >= 0)
|
||||||
|
{
|
||||||
ptr = *((char **)ptr) + view->suboffsets[0];
|
ptr = *((char **)ptr) + view->suboffsets[0];
|
||||||
}
|
}
|
||||||
return PyBytes_FromStringAndSize(ptr, view->itemsize);
|
return PyBytes_FromStringAndSize(ptr, view->itemsize);
|
||||||
|
|
Loading…
Reference in New Issue