reloading a C module

Alex cut_me_out at hotmail.com
Mon Sep 25 17:09:23 EDT 2000


> Should I be able to "reload" a C module?
> 
> I compile my module as a shared module (*.so), import it (import
> spam), and it works fine. Then I make some changes, re-compile it, and
> reload it ( reload(spam) ). Nothing changes. If I kill Python and
> restart it, then import again it works, so the *.so file has changed.

You're lucky; every time I've tried this, python has segfaulted.  I
restart python on each run when I debug a C extension.  If you use gdb,
it helps to make a python test script, and put something like this in a
.gdbinit file in the same directory as the module source:

r python -c "execfile('test_script')"

Alex.

-- 
Speak softly but carry a big carrot.




More information about the Python-list mailing list