Author: Christian Tismer <[email protected]>
Branch: win64_gborg
Changeset: r48751:96b9f3051fa4
Date: 2011-11-04 14:44 +0100
http://bitbucket.org/pypy/pypy/changeset/96b9f3051fa4/
Log: disabled errno check on win64 and py 2.7.2 - ctypes bug
diff --git a/pypy/rpython/lltypesystem/ll2ctypes.py
b/pypy/rpython/lltypesystem/ll2ctypes.py
--- a/pypy/rpython/lltypesystem/ll2ctypes.py
+++ b/pypy/rpython/lltypesystem/ll2ctypes.py
@@ -177,8 +177,17 @@
assert max_n >= 0
ITEM = A.OF
ctypes_item = get_ctypes_type(ITEM, delayed_builders)
+ # Python 2.5 ctypes can raise OverflowError on 64-bit builds
+ for n in [sys.maxint, 2**31]:
+ MAX_SIZE = n/64
+ try:
+ PtrType = ctypes.POINTER(MAX_SIZE * ctypes_item)
except (OverflowError, AttributeError), e:
pass # ^^^ bah, blame ctypes
+ else:
+ break
+ else:
+ raise e
class CArray(ctypes.Structure):
if not A._hints.get('nolength'):
@@ -210,6 +219,9 @@
cls._ptrtype = ctypes.POINTER(cls.MAX_SIZE * ctypes_item)
except OverflowError, e:
pass
+ except AttributeError, e:
+ pass # XXX win64 failure and segfault, afterwards:
+ # AttributeError: class must define a '_length_'
attribute, which must be a positive integer
else:
break
else:
diff --git a/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
b/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
--- a/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
+++ b/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
@@ -742,6 +742,8 @@
eci = ExternalCompilationInfo(includes=['string.h'])
if sys.platform.startswith('win'):
underscore_on_windows = '_'
+ if sys.version.startswith('2.7.2 '):
+ py.test.skip('ctypes is buggy. errno crashes with win64 and
python 2.7.2')
else:
underscore_on_windows = ''
strlen = rffi.llexternal('strlen', [rffi.CCHARP], rffi.SIZE_T,
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit