And we have a winner.
For reference the final code is below.
Thanks for your help,
-Chris
import array
cdef extern from "Python.h":
int PyObject_AsWriteBuffer(object obj, void **buffer, int *buffer_len)
int PyObject_AsReadBuffer(object obj, void **buffer, int *buffer_len)
object PySt
I replaced:
a = array.array('B', , [0] * (pixels * 2))
with:
a = PyString_FromStringAndSize(NULL, pixels * 2)
and got:
C:\work\testing\plink_o_ip>python ycbycr.py
Traceback (most recent call last):
File "ycbycr.py", line 62, in ?
ycbycr = image2ycbycr(im)
File "ycbycr.py", line 38, in imag
The memory is not temporary, I am passing it out as an array, thus the
malloc/free route will require double allocation(once for malloc/free,
once for array.array). I am not using string because when I tried to
pass the data in as string, pyrex complained about the conversion.
However, I could pr
On 6/8/05, Chris Lambacher <[EMAIL PROTECTED]> wrote:
> My question is, is there a better way to
> allocate the memory for the array.array object than:
> a = array.array('B', [0] * (pixels * 2))
cdef unsigned char *buffer
temp_string = PyString_FromStringAndSize(NULL, length)
buffer = PyStr