summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2007-10-11 19:51:32 (GMT)
committerThomas Heller <theller@ctypes.org>2007-10-11 19:51:32 (GMT)
commit7fee6dd2a37461d7779087ff754898d19180617b (patch)
tree2bfc8120467a7b8c62ebca44a944200012318ebb
parent631fee62351397e940e4616ef48f03788962c3eb (diff)
downloadcpython-7fee6dd2a37461d7779087ff754898d19180617b.zip
cpython-7fee6dd2a37461d7779087ff754898d19180617b.tar.gz
cpython-7fee6dd2a37461d7779087ff754898d19180617b.tar.bz2
On OS X, use os.uname() instead of gestalt.sysv(...) to get the
operating system version. This allows to use ctypes when Python was configured with --disable-toolbox-glue.
-rw-r--r--Lib/ctypes/__init__.py13
-rw-r--r--Misc/NEWS3
2 files changed, 6 insertions, 10 deletions
diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py
index 2e35307..1500896 100644
--- a/Lib/ctypes/__init__.py
+++ b/Lib/ctypes/__init__.py
@@ -24,19 +24,12 @@ if _os.name in ("nt", "ce"):
DEFAULT_MODE = RTLD_LOCAL
if _os.name == "posix" and _sys.platform == "darwin":
- import gestalt
-
- # 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.
+ # libraries. OS X 10.3 is Darwin 7, so we check for
+ # that.
- if gestalt.gestalt("sysv") < 0x1040:
+ if int(_os.uname()[2].split('.')[0]) < 8:
DEFAULT_MODE = RTLD_GLOBAL
from _ctypes import FUNCFLAG_CDECL as _FUNCFLAG_CDECL, \
diff --git a/Misc/NEWS b/Misc/NEWS
index 4492590..99d9249 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -272,6 +272,9 @@ Core and builtins
Library
-------
+- Patch #1203: ctypes now does work on OS X when Python is built with
+ --disable-toolbox-glue
+
- collections.deque() now supports a "maxlen" argument.
- itertools.count() is no longer bounded to LONG_MAX. Formerly, it raised