[Pyrex] C-API implementation in Pyrex 0.9.6

Stefan Behnel stefan_ml at behnel.de
Sun Oct 21 13:59:16 CEST 2007


Stefan Behnel wrote:
> Stefan Behnel wrote:
>> Stefan Behnel wrote:
>>>> I forgot to mention that this uses a package local import, so the first lines
>>>> of lxml/objectify.pyx look like this:
>>>>
>>>>     from etree cimport _Document, _Element, ElementBase
>>>>     from etree cimport _ElementIterator, ElementClassLookup
>>>>     from etree cimport elementFactory, textOf
>>>>     cimport etree as cetree
>>> I think the problem here is that __Pyx_ImportModule() does not take the
>>> current package into account. I'll fix it to first try an import based on the
>>> package of the current module and then try a global import.
>> I also think that Pyrex should not re-import a module for each type it wants
>> to cimport from it, but rather import each required module once, store it in a
>> global variable, and reuse it whenever it is accessed by generated code. I'll
>> see if I can fix this while I'm at it.
> 
> Here is a patch that fixes the imports for me.

Hmm, actually it doesn't. It breaks the C-API import in the header file.

Stefan




More information about the Pyrex mailing list