Is there an __init__ file the next level up?
On Jun 18, 2008, at 6:11 PM, Brian Granger wrote:
> HI,
>
> I am running cython-devel and have defined a simple extension type. I
> am finding that:
>
> IF: there is a __init__.py file in the same directory as my pxd
> and pyx file
>
> THEN: the pxd file is not processed and my extension type won't have
> any attributes defined in the C code
>
> This reproduces my problem:
>
> $ cat shrubbing.pxd
> cdef class Shrubbery:
> cdef int width
> cdef int length
>
> $ cat shrubbing.pyx
> cdef class Shrubbery:
> def __new__(self, int w, int l):
> self.width = w
> self.length = l
>
> $ ls
> __init__.py shrubbing.pxd shrubbing.pyx
> $ cython shrubbing.pyx
>
> This is what shrubbing.c has for the extension type struct:
>
> struct __pyx_obj_4temp_9shrubbing_Shrubbery {
> PyObject_HEAD
> };
>
> Notice, there are no attributes!!!!
>
> But not if I do:
>
> $ rm __init__.py
> $ ls
> shrubbing.c shrubbing.pxd shrubbing.pyx
> $ cython shrubbing.pyx
>
> I get the attributes in the extension type:
>
> struct __pyx_obj_9shrubbing_Shrubbery {
> PyObject_HEAD
> int width;
> int length;
> };
>
> I don't see how I could be doing something wrong. I swear this code
> was working just the other day (this is not really my code, but it
> does the same thing). The crazy thing is that I know sage uses
> __init__.py files in directories that have pxd and pyx files just like
> I am doing.
>
> Brian
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev