Update of /cvsroot/ctypes/ctypes/ctypes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv764
Modified Files:
Tag: branch_1_0
__init__.py
Log Message:
Remove import of unused symbol FreeLibrary.
Change the order of arguments in the CDLL constructor.
Index: __init__.py
===================================================================
RCS file: /cvsroot/ctypes/ctypes/ctypes/__init__.py,v
retrieving revision 1.61.2.25
retrieving revision 1.61.2.26
diff -C2 -d -r1.61.2.25 -r1.61.2.26
*** __init__.py 26 Jan 2006 19:49:14 -0000 1.61.2.25
--- __init__.py 26 Jan 2006 20:23:16 -0000 1.61.2.26
***************
*** 99,104 ****
if _os.name in ("nt", "ce"):
! from _ctypes import LoadLibrary as _LoadLibrary, \
! FreeLibrary as _FreeLibrary
from _ctypes import FUNCFLAG_HRESULT as _FUNCFLAG_HRESULT, \
FUNCFLAG_STDCALL as _FUNCFLAG_STDCALL
--- 99,103 ----
if _os.name in ("nt", "ce"):
! from _ctypes import LoadLibrary as _dlopen
from _ctypes import FUNCFLAG_HRESULT as _FUNCFLAG_HRESULT, \
FUNCFLAG_STDCALL as _FUNCFLAG_STDCALL
***************
*** 124,129 ****
elif _os.name == "posix":
! from _ctypes import dlopen as _LoadLibrary
! _FreeLibrary = None
from _ctypes import sizeof, byref, addressof, alignment
--- 123,127 ----
elif _os.name == "posix":
! from _ctypes import dlopen as _dlopen
from _ctypes import sizeof, byref, addressof, alignment
***************
*** 298,306 ****
_restype_ = c_int # default, can be overridden in instances
! _handle = 0
! def __init__(self, name, handle=None, mode=RTLD_LOCAL):
self._name = name
if handle is None:
! self._handle = _LoadLibrary(self._name, mode)
else:
self._handle = handle
--- 296,303 ----
_restype_ = c_int # default, can be overridden in instances
! def __init__(self, name, mode=RTLD_LOCAL, handle=None):
self._name = name
if handle is None:
! self._handle = _dlopen(self._name, mode)
else:
self._handle = handle
***************
*** 323,337 ****
return func
- # This creates problems in gc. See
- # https://sourceforge.net/tracker/index.php?func=detail&aid=1042541&group_id=71702&atid=532154
- # but since we cannot free the libraries anyway (the functions
- # retrieved don't keep a reference to the _DLL instance), it does no
- # harm to disable this code.
- #
- ## def __del__(self, FreeLibrary=_FreeLibrary):
- ## if self._handle != 0 and FreeLibrary:
- ## FreeLibrary(self._handle)
- ## self._handle = 0
-
class PyDLL(CDLL):
"""This class represents the Python library itself. It allows to
--- 320,323 ----
***************
*** 387,391 ****
if _os.name in ("nt", "ce"):
! pythonapi = PyDLL("python dll", _sys.dllhandle)
elif _sys.platform == "cygwin":
pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2])
--- 373,377 ----
if _os.name in ("nt", "ce"):
! pythonapi = PyDLL("python dll", None, _sys.dllhandle)
elif _sys.platform == "cygwin":
pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2])
|