Statically linked extension and relative import

  • Thread starter David Cournapeau
  • Start date
D

David Cournapeau

Hi,

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 'foo.bar'
form. For example, let's say the 3rd party module is laid out as
follows:

foo/__init__.py
foo/bar.so

and __init__.py contains:
import foo.bar

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.

thanks,

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top