[issue14597] Cannot unload dll in ctypes until script exits

Eryk Sun report at bugs.python.org
Mon Mar 1 08:25:57 EST 2021


Eryk Sun <eryksun at gmail.com> added the comment:

Automatically decrementing the reference count of a shared library (e.g. via WinAPI FreeLibrary or POSIX dlclose) when a CDLL instance is finalized would require significant design changes to ensure that all ctypes pointers, scalars, and aggregates that reference memory in the DLL also always reference the CDLL instance in their _objects attribute. I don't think this feature request is worth the work that involves, or the risk of crashing if some case is overlooked in the implementation. Nothing prevents a script from implementing this manually on a case by case basis.

----------
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue14597>
_______________________________________


More information about the Python-bugs-list mailing list