def __set__(self, list attributes not None): self._attributes = attributes
cdef int _test(self): self._attributes.append('foo') # ------------------------ #
I'm getting th following error:
t.c: In function ‘__pyx_f_5hello_3Bar__test’: t.c:1148:7: warning: comparison of distinct pointer types lacks a cast t.c:1155:56: error: ‘struct __pyx_obj_5hello_MyList’ has no member named ‘None’
However, if I declare list as an explicit extern type:
cdef extern from "listobject.h": ctypedef class __builtin__.list [object PyListObject]: pass
It works. Am I doing something wrong here or is this a bug?
> def __set__(self, list attributes not None): > self._attributes = attributes
> cdef int _test(self): > self._attributes.append('foo') > # ------------------------ #
> I'm getting th following error:
> t.c: In function ‘__pyx_f_5hello_3Bar__test’: > t.c:1148:7: warning: comparison of distinct pointer types lacks a cast > t.c:1155:56: error: ‘struct __pyx_obj_5hello_MyList’ has no member named ‘None’
> However, if I declare list as an explicit extern type:
> cdef extern from "listobject.h": > ctypedef class __builtin__.list [object PyListObject]: > pass
> It works. Am I doing something wrong here or is this a bug?
This is a bug. However, note that the cython builtin "list" means exactly a list (no subclasses allowed), otherwise we can't safely optimize it (or, at least, we'd have to re-work our optimizations to include dispatches to generic code, in which case there's little benefit to typing it something other than "object."
> This is a bug. However, note that the cython builtin "list" means > exactly a list (no subclasses allowed), otherwise we can't safely > optimize it (or, at least, we'd have to re-work our optimizations to > include dispatches to generic code, in which case there's little > benefit to typing it something other than "object."
Ok, thanks for the explanation! Is there a ticket created for this?
On Mon, May 30, 2011 at 2:28 AM, Saúl Ibarra Corretgé <sag...@gmail.com> wrote:
> Hi Robert,
>> This is a bug. However, note that the cython builtin "list" means >> exactly a list (no subclasses allowed), otherwise we can't safely >> optimize it (or, at least, we'd have to re-work our optimizations to >> include dispatches to generic code, in which case there's little >> benefit to typing it something other than "object."
> Ok, thanks for the explanation! Is there a ticket created for this?
I don't think so (short of the fact that I tagged this email as "bug" to not forget it :), feel free to file one.