[Pyrex] A patch for cimport

Dan Gindikin dg at pnylab.com
Tue Jan 22 15:38:21 CET 2008


If you have the following setup:
	
	pkg/__init__.py

	pkg/main.pyx
	
		cimport submod
		
	pkg/submod.pyx

		cdef cfunc(): pass
		
	pkg/submod.pxd

		cdef cfunc()
		
and you do

	% python -c "import pkg.main"
	
you will get an import error.

This happens because "cimport submod" in main.pyx causes a call to
"__Pyx_ImportType", which in turn calls "__Pyx_ImportModule", which does not
honor the package context, and thus tries to import "submod" instead of
"pkg.submod".

Patch for "__Pyx_ImportModule" against Pyrex-0.9.6.4 attached.

-- 
Dan

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cimport_pyx_import_module.patch
Url: http://lists.copyleft.no/pipermail/pyrex/attachments/20080122/347b0dd9/attachment.ksh 


More information about the Pyrex mailing list