[pypy-issue] Issue #2909: PyObject_GetBuffer fails on arrays (pypy/pypy)

Louis Sautier issues-reply at bitbucket.org
Sat Nov 3 14:01:28 EDT 2018


New issue 2909: PyObject_GetBuffer fails on arrays
https://bitbucket.org/pypy/pypy/issues/2909/pyobject_getbuffer-fails-on-arrays

Louis Sautier:

Hello, the regex package [fails tests with PyPy](https://bitbucket.org/mrabarnett/mrab-regex/issues/145/1-fail-in-testsuite-under-pypy).


Apparently `PyObject_GetBuffer(string, &str_info->view, PyBUF_SIMPLE)` does not work on `array.array` types. The relevant code is [here](https://bitbucket.org/mrabarnett/mrab-regex/src/cec0dc244e5dad3fa3994ed527ee4928b79332ef/regex_2/_regex.c#lines-17501)

Test programme:
```py
import regex
import array

a = array.array("c")
regex.compile("bla").match(a)
```

Result:
```
pypy test.py
PyObject_GetBuffer failed!
Traceback (most recent call last):
  File "test.py", line 5, in <module>
    regex.compile("bla").match(a)
TypeError: expected string or buffer
```




More information about the pypy-issue mailing list