[pypy-svn] r56432 - pypy/dist/pypy/lib/ctypes

henrikv at codespeak.net henrikv at codespeak.net
Fri Jul 11 09:56:47 CEST 2008


Author: henrikv
Date: Fri Jul 11 09:56:46 2008
New Revision: 56432

Modified:
   pypy/dist/pypy/lib/ctypes/__init__.py
Log:
(henrikv,fijal,Bill Janssen) Use sys.platform instead of gestalt, as it is not distribution dependant. ctypes tests pass on Mac OSX 


Modified: pypy/dist/pypy/lib/ctypes/__init__.py
==============================================================================
--- pypy/dist/pypy/lib/ctypes/__init__.py	(original)
+++ pypy/dist/pypy/lib/ctypes/__init__.py	Fri Jul 11 09:56:46 2008
@@ -24,19 +24,13 @@
 
 DEFAULT_MODE = RTLD_LOCAL
 if _os.name == "posix" and _sys.platform == "darwin":
-    import gestalt
+    import platform
 
-    # gestalt.gestalt("sysv") returns the version number of the
-    # currently active system file as BCD.
-    # On OS X 10.4.6 -> 0x1046
-    # On OS X 10.2.8 -> 0x1028
-    # See also http://www.rgaros.nl/gestalt/
-    #
     # On OS X 10.3, we use RTLD_GLOBAL as default mode
     # because RTLD_LOCAL does not work at least on some
     # libraries.
 
-    if gestalt.gestalt("sysv") < 0x1040:
+    if [10, 4] > [int(x) for x in platform.release().split('.')[:2]]:
         DEFAULT_MODE = RTLD_GLOBAL
 
 from _ctypes import FUNCFLAG_CDECL as _FUNCFLAG_CDECL, \



More information about the Pypy-commit mailing list