Robert Bradshaw wrote: >> Hmm. I'm not against that -- would you then be ok with >> >> cdef int[:] foo >> >> not giving any object access at all? (The thing is I also want to >> use it >> to access arrays stored in C pointers etc.; + safe passing around of >> buffers in nogil mode!) > > I could accept that, I trust that the details could be worked out > nicely. Would be like a char* from an object, where the user is > required to keep the object around long enough?
With C pointers, yes. With buffers acquired from Python objects it would hold a reference, but I was thinking only acquisition/release would require GIL. I.e. cdef int[:] a = obj # requires GIL cdef int[:] b = a # does not require GIL -- extra "acquisition count" # (remember that acquisition does have a speed penalty too, that # really must go if one wants to use efficient slices inside # numeric loops) In some very contrived cases a release could be needed within a nogil block though...there are ways to resolve that (release queues or reacquiring the GIL temporarily). But users are unlikely to produce code requiring it. I think I didn't manage to communicate my intentions regarding the other question with object[...] vs. templates, but now my daughter is awake so it'll have to wait :-) -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
