cpython: e8fe32d43c96 (original) (raw)

Mercurial > cpython

changeset 94490:e8fe32d43c96

Issue #14203: Remove obsolete support for view==NULL in PyBuffer_FillInfo() and bytearray_getbuffer(). Both functions now raise BufferError in that case. [#14203]

Stefan Krah skrah@bytereef.org
date Tue, 03 Feb 2015 16:57:21 +0100
parents 7494f3972726
children 17cda5a92b6a
files Misc/NEWS Modules/_testcapimodule.c Objects/abstract.c Objects/bytearrayobject.c
diffstat 4 files changed, 51 insertions(+), 9 deletions(-)[+] [-] Misc/NEWS 4 Modules/_testcapimodule.c 34 Objects/abstract.c 7 Objects/bytearrayobject.c 15

line wrap: on

line diff

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -1560,6 +1560,10 @@ Build C API ----- +- Issue #14203: Remove obsolete support for view==NULL in PyBuffer_FillInfo()

--- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -2518,6 +2518,39 @@ test_from_contiguous(PyObject* self, PyO Py_RETURN_NONE; }

+

+

+

+

+ +error:

+} /* Test that the fatal error from not having a current thread doesn't cause an infinite loop. Run via Lib/test/test_capi.py */ @@ -3179,6 +3212,7 @@ static PyMethodDef TestMethods[] = { {"test_unicode_compare_with_ascii", (PyCFunction)test_unicode_compare_with_ascii, METH_NOARGS}, {"test_capsule", (PyCFunction)test_capsule, METH_NOARGS}, {"test_from_contiguous", (PyCFunction)test_from_contiguous, METH_NOARGS},

--- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -612,7 +612,12 @@ int PyBuffer_FillInfo(Py_buffer *view, PyObject *obj, void *buf, Py_ssize_t len, int readonly, int flags) {

+ if (((flags & PyBUF_WRITABLE) == PyBUF_WRITABLE) && (readonly == 1)) { PyErr_SetString(PyExc_BufferError,

--- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -60,18 +60,17 @@ static int static int bytearray_getbuffer(PyByteArrayObject *obj, Py_buffer *view, int flags) {

} static void