On Mon, Jul 28, 2014 at 11:02 AM, Robert Bradshaw <rober...@gmail.com> wrote:
> On Sun, Jul 27, 2014 at 9:34 PM, Kurt Smith <kwmsm...@gmail.com> wrote: > > > I have sorted out all the code > > generation pieces and nearly have a minimal example working, and will > have > > something for you to review soon. From what I can tell, Cython has some > > baked-in assumptions when it comes to assignment statements. Telling > Cython > > that in this case, no, don't assign to something at the C level, instead > > generate a function call and pass in the lvalue by reference takes some > > doing. > > Yeah, I'm not too surprised about that. > > I have an initial version working for assigning a Python object to a fixed-size array. It's special cased to C ints and pretty messy in parts, but it gets the job done. I have some ideas on how to generalize the type. Like I said, I'll need your input on the right way to do some things. Will clean it up and put up a PR as soon as I can. Once this is in place, assigning a dict-like object to a struct can build on it. There are a number of other little things that would be nice, like allowing slice assignment: c_arr[5:13] = obj and initializing a dynamic C array with a Python object, provided the extent is specified: cdef int *arr = <int*>malloc(N * sizeof(int)) arr[:N] = obj
_______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel