[pypy-svn] r77941 - pypy/trunk/pypy/module/_rawffi
arigo at codespeak.net
arigo at codespeak.net
Thu Oct 14 17:15:19 CEST 2010
Author: arigo
Date: Thu Oct 14 17:15:12 2010
New Revision: 77941
Modified:
pypy/trunk/pypy/module/_rawffi/array.py
Log:
Add a workaround for the libffi x86_64 bug.
Modified: pypy/trunk/pypy/module/_rawffi/array.py
==============================================================================
--- pypy/trunk/pypy/module/_rawffi/array.py (original)
+++ pypy/trunk/pypy/module/_rawffi/array.py Thu Oct 14 17:15:12 2010
@@ -97,7 +97,14 @@
class W_ArrayInstance(W_DataInstance):
def __init__(self, space, shape, length, address=r_uint(0)):
- W_DataInstance.__init__(self, space, shape.size * length, address)
+ # XXX workaround for a bug in libffi on x86_64: make sure that
+ # we always have at least 8 bytes. For W_ArrayInstances that are
+ # used as the result value of a function call, ffi_call() writes
+ # 8 bytes into it even if the function's result type asks for less.
+ memsize = shape.size * length
+ if memsize < 8:
+ memsize = 8
+ W_DataInstance.__init__(self, space, memsize, address)
self.length = length
self.shape = shape
More information about the Pypy-commit
mailing list