Can't pass size as keyward arg to ffi.buffer for compiled ffi
Created originally on Bitbucket by flacjacket (Sean Vig)
Using a compiled ffi, ffi.buffer()
complains when trying to pass size
as a kwarg. For a minimal example, compile:
import cffi
ffi = cffi.FFI()
ffi.set_source('_ffi', None)
if __name__ == '__main__':
ffi.compile()
Then:
In [1]: from _ffi import ffi
In [2]: ffi.buffer(ffi.NULL, 8)
Out[2]: <_cffi_backend.buffer at 0x7f200574c480>
In [3]: ffi.buffer(ffi.NULL, size=8)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-82a246219aa5> in <module>()
----> 1 ffi.buffer(ffi.NULL, size=8)
TypeError: buffer() takes no keyword arguments
This also fails for API-based compiled ffi objects.
Where as if we import the un-compiled ffi from the file, it is fine:
In [4]: from ffi_build import ffi
In [5]: ffi.buffer(ffi.NULL, size=8)
Out[5]: <_cffi_backend.buffer at 0x7f20042cf5a0>
This isn't a big deal, it can just be passed as a non-keyword arg, but it may break things when switching to compiled ffi objects.