From 23dcae1d70a65b4789f72094e696905089efdeac Mon Sep 17 00:00:00 2001 From: Lisandro Dalcin Date: Sat, 11 May 2013 11:23:56 +0300 Subject: [PATCH] PyPy: version 2.0 fixed PyBuffer_FillInfo() --- src/atimport.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/atimport.h b/src/atimport.h index c3ac6a6..d91eac1 100644 --- a/src/atimport.h +++ b/src/atimport.h @@ -345,16 +345,15 @@ _PyLong_AsByteArray(PyLongObject* v, return -1; } +#if PY_VERSION_HEX < 0x02070300 /* PyPy < 2.0 */ static int PyBuffer_FillInfo_PyPy(Py_buffer *view, PyObject *obj, void *buf, Py_ssize_t len, int readonly, int flags) { if (view == NULL) return 0; - if (((flags & PyBUF_WRITABLE) == PyBUF_WRITABLE) && - (readonly == 1)) { - PyErr_SetString(PyExc_BufferError, - "Object is not writable."); + if ((flags & PyBUF_WRITABLE) && readonly) { + PyErr_SetString(PyExc_BufferError, "Object is not writable."); return -1; } if (PyBuffer_FillInfo(view, obj, buf, len, readonly, flags) < 0) @@ -363,6 +362,7 @@ PyBuffer_FillInfo_PyPy(Py_buffer *view, PyObject *obj, return 0; } #define PyBuffer_FillInfo PyBuffer_FillInfo_PyPy +#endif static PyObject * PyMemoryView_FromBuffer_PyPy(Py_buffer *view)