Hi,
I ran into some odd behavior when working on my cython-based project
(h5py). The following cython code snippet is the culprit ("priv" is a
function argument of type void**):
cdef conv_size_t *sizes
priv[0] = sizes = <conv_size_t*>malloc(sizeof(conv_size_t))
gets turned into this (with Cython 0.14.1):
(__pyx_v_priv[0]) = ((__pyx_t_4h5py_5_conv_conv_size_t
*)malloc((sizeof(__pyx_t_4h5py_5_conv_conv_size_t))));
__pyx_v_sizes = ((__pyx_t_4h5py_5_conv_conv_size_t
*)malloc((sizeof(__pyx_t_4h5py_5_conv_conv_size_t))));
which leads to much head-scratching when one initializes "sizes", and
then later tries to recover that value via "priv". Interestingly,
Cython 0.13 correctly initializes both priv[0] and sizes to the same
value:
__pyx_t_5 = ((__pyx_t_4h5py_5_conv_conv_size_t
*)malloc((sizeof(__pyx_t_4h5py_5_conv_conv_size_t))));
(__pyx_v_priv[0]) = __pyx_t_5;
__pyx_v_sizes = __pyx_t_5;
I wasn't able to find anything on this in the list archives or issue
tracker. Right now I'm working around it by splitting the statement
into multiple lines:
sizes = <conv_size_t*>malloc(sizeof(conv_size_t))
priv[0] = sizes
Andrew
_______________________________________________
cython-devel mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cython-devel