[Patches] [Patch #101713] Free extension DLLs' handles during the Py_Finalize()

noreply@sourceforge.net noreply@sourceforge.net
Fri, 29 Sep 2000 12:09:36 -0700


Patch #101713 has been updated. 

Project: 
Category: Windows
Status: Open
Summary: Free extension DLLs' handles during the Py_Finalize()

Follow-Ups:

Date: 2000-Sep-29 12:09
By: Markovitch

Comment:
This patch is intended to fix the following problem:
Python on Windows never frees DLLs loaded as extension. Whenever it's not a big problem when the interpreter is being used in a standart way, it becomes THE problem (or even a disaster) when the interpreter DLL is dynamically 
initialized/finalized from one process many times during single run.
Moreover, even in case of single initialization there is a trap - DLLs loaded by mistake are unloaded only then a process finishes (e.g. suppose there is a foo.dll in the current directory and foo.dll is NOT a Python extension;
"import foo" ends up with error, but foo.dll will be anging in process' address space!)

This patch
    1) frees a DLL handle in case of it has no proper initialization funcion
    2) registers in an internal array all handles of successfully loaded dynamic extensions
    2) frees all registered handles during Py_Finalize()
    
Yakov Markovitch,
markovitch@iso.ru    
-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=101713&group_id=5470