[commit: ghc] master: Fallback to `ctypes.cdll` if `ctypes.windll` unavailable (1032554)
git at git.haskell.org
git at git.haskell.org
Sat Oct 11 09:47:45 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/1032554a7084a12d38a08beaaeb7a07088883e29/ghc
>---------------------------------------------------------------
commit 1032554a7084a12d38a08beaaeb7a07088883e29
Author: Gintautas Miliauskas <gintautas.miliauskas at gmail.com>
Date: Wed Sep 17 20:57:04 2014 +0200
Fallback to `ctypes.cdll` if `ctypes.windll` unavailable
On Windows, we may be using a native build of Python or a mingw/msys build. The
former exports `ctypes.windll`, the latter exports `cdll`. Previously the code
threw an exception when using the msys Python because it expected `windll` to
always be available on Windows.
Differential Revision: https://phabricator.haskell.org/D308
>---------------------------------------------------------------
1032554a7084a12d38a08beaaeb7a07088883e29
testsuite/driver/runtests.py | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py
index 103c7ac..cc55dad 100644
--- a/testsuite/driver/runtests.py
+++ b/testsuite/driver/runtests.py
@@ -149,13 +149,11 @@ if windows:
# Try to use UTF8
if windows:
import ctypes
- if config.cygwin:
- # Is this actually right? Which calling convention does it use?
- # As of the time of writing, ctypes.windll doesn't exist in the
- # cygwin python, anyway.
- mydll = ctypes.cdll
- else:
+ # Windows Python provides windll, mingw python provides cdll.
+ if hasattr(ctypes, 'windll'):
mydll = ctypes.windll
+ else:
+ mydll = ctypes.cdll
# This actually leaves the terminal in codepage 65001 (UTF8) even
# after python terminates. We ought really remember the old codepage
More information about the ghc-commits
mailing list