[Pyrex] Troubles with C array (e.g. float[3]) and Pyrex 0.9.5.1a

Jiba jibalamy at free.fr
Tue May 8 18:17:38 UTC 2007


Hi all,

I am experimenting several troubles with Pyrex 0.9.5.1a (and Python 2.5).

First, it seems that it is no longer possible to shift a pointer using the "<pointer> + <int>" syntax, when the pointer is defined using the "<type>[<length>]" syntax.

Second, it seems that such pointers are no longer automatically casted toward void*.

I also get errors related to Enum, but it is already well-known on this mailing list.


The small program below illustrate the two problems (the program has no sense and is not write to be executed, it would probably segfault !).
It was compiling with Pyrex version 0.9.4.1, but generates 2 errors with 0.9.5.1a:

/tmp/aaa.pyx:7:8: Invalid operand types for '+' (float ([3]); int)
/tmp/aaa.pyx:9:7: Cannot assign type 'float ([3])' to 'void (*)'


In conclusion, it looks like C arrays such as "float[3]" are no longer considered as pointer by Pyrex. Is that normal ?

Jiba

--------------------------------------------------------

cdef extern from "string.h":
	void memcpy(void* des, void* src, int size)

cdef float f1[3]
cdef float* f2

f2 = f1 + (<int> 1)

memcpy(f1, f2, 1)



More information about the Pyrex mailing list