This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Adam
Recipients Adam
Date 2015-02-06.18:21:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1423246900.58.0.18702391948.issue23402@psf.upfronthosting.co.za>
In-reply-to
Content
I think dynload_shlib (and maybe some of the other non-ldl dynamic library loaders?) should close the libraries when the interpreter is shut down. Currently the handles are not ever closed and in ldl's case sometimes leaked.

The reason I desire this behavior is I have Python opening a shared library that I also open (all within the same process), and I want to be able to reload the library at runtime (via dlclose() + dlopen()) by shutting down the Python interpreter, dlclose()/dlopen(), and re-starting Python on the other side, however having the hanging reference to the library within the interpreter is preventing my dlclose() call from unloading the library.

I have attached a patch for dynload_shlib.c that tracks all handles returned by dlopen() and will close them properly when the interpreter is shut down.
History
Date User Action Args
2015-02-06 18:21:40Adamsetrecipients: + Adam
2015-02-06 18:21:40Adamsetmessageid: <1423246900.58.0.18702391948.issue23402@psf.upfronthosting.co.za>
2015-02-06 18:21:40Adamlinkissue23402 messages
2015-02-06 18:21:40Adamcreate