[pypy-issue] Issue #2453: PyObject_GetBuffer Regression (pypy/pypy)

eric s issues-reply at bitbucket.org
Mon Dec 19 17:56:04 EST 2016


New issue 2453: PyObject_GetBuffer Regression
https://bitbucket.org/pypy/pypy/issues/2453/pyobject_getbuffer-regression

eric s:

There's a regression in PyObject_GetBuffer between 5.3.x and 5.4.x, and still appearing in 5.6.x, noticed in testing on the Pillow project.  The core failure is "TypeError: PyPy does not yet implement the new buffer interface" when passing a string into PyObject_GetBuffer.

The following reproduction is the clearest Pillow code, but due to a lack of catching the error, it continues and later throws a different error. 

Using either Pillow 3.4.2 or current master, the following code succeeds in 5.3 but not in 5.4


```
#!python

from PIL import ImagePath
import array

arr = array.array("f", [0, 1])
p = ImagePath.Path(arr.tostring())

```

The line where this code diverges is in Pillow's _imaging.c, 
```
    if (PyObject_CheckBuffer(buffer)) {
        return PyObject_GetBuffer(buffer, view, PyBUF_SIMPLE);
    }
```
This call succeeds in 5.3 and fails in 5.4, returning a -1. It succeeds in CPython 2.7. 

This is a travis run triggering this bug: https://travis-ci.org/python-pillow/Pillow/jobs/184160459


Pillow is working around this by actually handling the error: https://github.com/python-pillow/Pillow/pull/2294




More information about the pypy-issue mailing list