Statically linked extension and relative import

David Cournapeau cournape at
Thu May 7 05:33:10 EDT 2009


I am trying to build a 3rd party extension and link it statically to
python. I managed to get things working by customizing Setup.local in
python source tree, but I have a problem for imports of the ''
form. For example, let's say the 3rd party module is laid out as


and contains:

I can build the bar extension and link it statically to python such as
from python, "import bar" works. But how can I make it "recognize"
"from foo import bar" ? I tried to understand how this works at the C
level in import.c, but I am a bit lost in the code. The ultimate goal
is to manage to get code coverage of the C code of the extension
through gcov, which does not support coverage of shared libraries ATM.



More information about the Python-list mailing list