From 01e31bfd84ad70264b6b5a903c88020f0d2cf671 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 19 Dec 2016 14:16:06 -0800 Subject: [PATCH] Workaround for 'PyPy does not yet implement the new buffer interface' bug --- _imaging.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_imaging.c b/_imaging.c index e2320d862..a82aa493c 100644 --- a/_imaging.c +++ b/_imaging.c @@ -251,7 +251,9 @@ int PyImaging_GetBuffer(PyObject* buffer, Py_buffer *view) /* Use new buffer protocol if available (mmap doesn't support this in 2.7, go figure) */ if (PyObject_CheckBuffer(buffer)) { - return PyObject_GetBuffer(buffer, view, PyBUF_SIMPLE); + int success = PyObject_GetBuffer(buffer, view, PyBUF_SIMPLE); + if (!success) { return success; } + PyErr_Clear(); } /* Pretend we support the new protocol; PyBuffer_Release happily ignores