[Cython] [Refactor] Emulated types

Carlos Pita carlosjosepita at gmail.com
Sun Oct 18 18:31:06 EDT 2015


>
> 3) cython.address will create a pointer from a list, another pointer or an
> instance of ArrayType (although, as I commented before: I see no
> compiler-compatible way to instantiate an ArrayType).
>

I just realized this is not an accurate description of what cython.address
does, but of what PointerType does instead. I hadn't noticed the [] boxing
cython.address does when creating the pointer. So I guess the list case in
the PointerType constructor is there just to support this boxed parameter,
not lists per se. Nevertheless my main concerns still stand: (i) the boxing
won't make cython.address(x) equivalent to &x when x is, say, an int (you
get a "pointer to the box", not a "pointer to the int"); (ii) I don't know
how to create an instance of ArrayType in a way the compiler likes (and I
don't understand the point of doing that, even if it were possible)  and
(iii) in any case that array will be copied when the PointerType constructor
type casts it, so I won't really get a pointer to an array but a new array
instead.

Sorry for the autoanswering, I'm a bit overwhelmed with my first intimate
contact with cython. Any clarifications will be *very much* appreciated.

Regards
--
Carlos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20151018/bc699691/attachment.html>


More information about the cython-devel mailing list