Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r1513:9461998086e5 Date: 2014-06-16 15:41 +0200 http://bitbucket.org/cffi/cffi/changeset/9461998086e5/
Log: Force the "strides" to be non-NULL. With a NULL strides, CPython >= 3.3 seems to segfault when doing "mymemoryview[:5] = ffi.buffer(..)". I have no clue how we're supposed to use this messy interface. diff --git a/c/minibuffer.h b/c/minibuffer.h --- a/c/minibuffer.h +++ b/c/minibuffer.h @@ -105,8 +105,12 @@ static int mb_getbuf(MiniBufferObj *self, Py_buffer *view, int flags) { - return PyBuffer_FillInfo(view, NULL, self->mb_data, self->mb_size, - /*readonly=*/0, PyBUF_CONTIG | PyBUF_FORMAT); + static Py_ssize_t dummy_stride = 1; + int res = PyBuffer_FillInfo(view, (PyObject *)self, + self->mb_data, self->mb_size, + /*readonly=*/0, PyBUF_CONTIG | PyBUF_FORMAT); + view->strides = &dummy_stride; + return res; } static PySequenceMethods mb_as_sequence = { _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit