[Python-checkins] r43709 - in python/trunk: Lib/ctypes/init.py Lib/ctypes/_loader.py Modules/_ctypes/_ctypes.c (original) (raw)

thomas.heller python-checkins at python.org
Thu Apr 6 17:23:17 CEST 2006


Author: thomas.heller Date: Thu Apr 6 17:23:16 2006 New Revision: 43709

Modified: python/trunk/Lib/ctypes/init.py python/trunk/Lib/ctypes/_loader.py python/trunk/Modules/_ctypes/_ctypes.c Log: Expose RTLD_LOCAL and RTLD_GLOBAL always from the _ctypes extension module. If RTLD_LOCAL is not #defined in any header file (Windows), set it to 0. If RTLD_GLOBAL is not #defined, set it equal to RTLD_LOCAL.

This should fix ctypes on cygwin.

Modified: python/trunk/Lib/ctypes/init.py

--- python/trunk/Lib/ctypes/init.py (original) +++ python/trunk/Lib/ctypes/init.py Thu Apr 6 17:23:16 2006 @@ -9,11 +9,7 @@ from _ctypes import _Pointer from _ctypes import CFuncPtr as _CFuncPtr from _ctypes import version as _ctypes_version -try: - from _ctypes import RTLD_LOCAL, RTLD_GLOBAL -except (ImportError, AttributeError): - RTLD_GLOBAL = RTLD_LOCAL = None

+from _ctypes import RTLD_LOCAL, RTLD_GLOBAL from _ctypes import ArgumentError

from struct import calcsize as _calcsize

Modified: python/trunk/Lib/ctypes/_loader.py

--- python/trunk/Lib/ctypes/_loader.py (original) +++ python/trunk/Lib/ctypes/_loader.py Thu Apr 6 17:23:16 2006 @@ -1,14 +1,11 @@ -# WORK IN PROGRESS! DO NOT (yet) USE! import sys, os import ctypes -all = ["LibraryLoader", "RTLD_LOCAL", "RTLD_GLOBAL"]

if os.name in ("nt", "ce"): from _ctypes import LoadLibrary as dlopen

else:

+from _ctypes import RTLD_LOCAL, RTLD_GLOBAL

_findLib(name) returns an iterable of possible names for a library.

if os.name in ("nt", "ce"):

Modified: python/trunk/Modules/_ctypes/_ctypes.c

--- python/trunk/Modules/_ctypes/_ctypes.c (original) +++ python/trunk/Modules/_ctypes/_ctypes.c Thu Apr 6 17:23:16 2006 @@ -4575,10 +4575,20 @@ PyModule_AddObject(m, "_wstring_at_addr", PyLong_FromVoidPtr(wstring_at)); #endif

-#ifdef RTLD_LOCAL +/* If RTLD_LOCAL is not defined (Windows!), set it to zero. / +#ifndef RTLD_LOCAL +#define RTLD_LOCAL 0 +#endif + +/ If RTLD_GLOBAL is not defined (cygwin), set it to the same value as

-#endif

 PyExc_ArgError = PyErr_NewException("ctypes.ArgumentError", NULL, NULL);
 if (PyExc_ArgError) {


More information about the Python-checkins mailing list