[pypy-issue] [issue1276] PyBuffer_FillInfo() and readonly parameter

Lisandro Dalcin tracker at bugs.pypy.org
Wed Oct 3 16:40:34 CEST 2012


New submission from Lisandro Dalcin <dalcinl at gmail.com>:

I understand the implementation of PyBuffer_FillInfo() is incomplete, but at 
least it is enough to pass back and forth raw buffers in C code. However, there 
is an issue with the handling of the "readonly" parameter: PyPy ignores 
"readonly" parameter and set view.readonly depening on PyBUF_WRITABLE bitfield 
in "flags" parameter.

The correct behavior is to generate an error if readonly=1 and 
flags&PyBUF_WRITABLE, and set view.readonly = readonly. 
http://hg.python.org/cpython/file/v2.7.3/Objects/abstract.c#l680

I was able to workaround this issue with a bit of C monkeypatching: 
https://code.google.com/p/mpi4py/source/browse/src/atimport.h#336

PS: http://mail.python.org/pipermail/cython-devel/2012-October/003177.html

----------
messages: 4816
nosy: dalcinl, pypy-issue
priority: bug
status: unread
title: PyBuffer_FillInfo() and readonly parameter

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1276>
________________________________________


More information about the pypy-issue mailing list