[pypy-commit] pypy default: Fix for issue #1787
arigo
noreply at buildbot.pypy.org
Sat Jun 21 20:44:07 CEST 2014
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r72118:d1b0787cfc90
Date: 2014-06-21 10:56 +0200
http://bitbucket.org/pypy/pypy/changeset/d1b0787cfc90/
Log: Fix for issue #1787
diff --git a/pypy/module/_rawffi/interp_rawffi.py b/pypy/module/_rawffi/interp_rawffi.py
--- a/pypy/module/_rawffi/interp_rawffi.py
+++ b/pypy/module/_rawffi/interp_rawffi.py
@@ -508,7 +508,10 @@
argshapes = unpack_argshapes(space, w_args)
resshape = unpack_resshape(space, w_res)
ffi_args = [shape.get_basic_ffi_type() for shape in argshapes]
- ffi_res = resshape.get_basic_ffi_type()
+ if resshape is not None:
+ ffi_res = resshape.get_basic_ffi_type()
+ else:
+ ffi_res = ffi_type_void
try:
ptr = RawFuncPtr('???', ffi_args, ffi_res, rffi.cast(rffi.VOIDP, addr),
flags)
diff --git a/pypy/module/_rawffi/test/test__rawffi.py b/pypy/module/_rawffi/test/test__rawffi.py
--- a/pypy/module/_rawffi/test/test__rawffi.py
+++ b/pypy/module/_rawffi/test/test__rawffi.py
@@ -353,6 +353,11 @@
assert ptr[0] == rawcall.buffer
ptr.free()
+ def test_raw_callable_returning_void(self):
+ import _rawffi
+ _rawffi.FuncPtr(0, [], None)
+ # assert did not crash
+
def test_short_addition(self):
import _rawffi
lib = _rawffi.CDLL(self.lib_name)
More information about the pypy-commit
mailing list