Robert Bradshaw wrote:

> cimport imports c definitions, which must be declared in .pxd files.  
> Do you have a .pxd file? If not, that's probably the issue.

OK let me detail what I'm doing ;-)

foo.pxd
cdef foo()

foo.pyx
cdef foo():
    pass

bar.pyx
cimport foo
foo.foo()

Once both compiled, importing bar is OK.

Now I move foo.pyd and bar.pyd into a package (pkg).
Then I import pkg.bar. It fails importing foo.

As previously mentionned, this is because "cimport foo" is mapped using
PyImport_Import(), that lets parameter globals to NULL.

The issue can be solved by replacing, in

static PyObject *__Pyx_ImportModule(char *name)

    py_module = PyImport_Import(py_name);
by
    py_module = __Pyx_Import(py_name, 0);

Cheers,
Stephane

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to