[ python-Bugs-1144263 ] reload() is broken for C extension objects

SourceForge.net noreply at sourceforge.net
Sat Feb 19 10:20:14 CET 2005


Bugs item #1144263, was opened at 2005-02-19 04:20
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1144263&group_id=5470

Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Matthew G. Knepley (knepley)
Assigned to: Nobody/Anonymous (nobody)
Summary: reload() is broken for C extension objects

Initial Comment:
1) A C extension module (foo.so) is imported

      import foo

2) The library foo.so is rebuilt with changes

3) We reload the module

      foo = reload(foo)

The reload() method calls imp.load_dynamic() which
eventually gets down to _PyImport_GetDynLoadFunc().
This just calls dlopen(), which returns the old filehandle.

This problem can be fixed by augmenting imp with
unload_dynamic(), which could easily be implemented in
a _PyImport_GetDynUnloadFunc(), which would just
consult its handles[] array, and call dlclose() on the
appropriate handle. This will work if Python was the
only program to dlopen() foo.so.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1144263&group_id=5470


More information about the Python-bugs-list mailing list