New issue 2751: cpyext: PyObject_AsWriteBuffer() does not work with 
array.array()
https://bitbucket.org/pypy/pypy/issues/2751/cpyext-pyobject_aswritebuffer-does-not

Christoph Reiter:

In Python:

```
#!python
data = array.array('B', [0])
```
 
passing this to the following C code:


```
#!C
...
unsigned char *buffer;
Py_ssize_t buffer_len;
PyObject *obj;

if (!PyArg_ParseTuple (args, "O", &obj))
    return NULL;

res = PyObject_AsWriteBuffer (obj, (void **)&buffer, &buffer_len);
if (res == -1)
    return NULL;
...
```

fails with "TypeError: expected a writeable buffer object" while it succeeds 
with CPython.


_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to