[pypy-commit] pypy fast_cffi_list_init: a failing test and the corresponding fix. I hate RPython, this corresponds to a segfault after translation :-/
antocuni
noreply at buildbot.pypy.org
Fri Oct 11 17:13:04 CEST 2013
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: fast_cffi_list_init
Changeset: r67319:0cffbb8df165
Date: 2013-10-11 17:12 +0200
http://bitbucket.org/pypy/pypy/changeset/0cffbb8df165/
Log: a failing test and the corresponding fix. I hate RPython, this
corresponds to a segfault after translation :-/
diff --git a/pypy/module/_cffi_backend/ctypeptr.py b/pypy/module/_cffi_backend/ctypeptr.py
--- a/pypy/module/_cffi_backend/ctypeptr.py
+++ b/pypy/module/_cffi_backend/ctypeptr.py
@@ -42,6 +42,12 @@
def is_char_or_unichar_ptr_or_array(self):
return isinstance(self.ctitem, ctypeprim.W_CTypePrimitiveCharOrUniChar)
+ def aslist_int(self, cdata):
+ return None
+
+ def aslist_float(self, cdata):
+ return None
+
def cast(self, w_ob):
# cast to a pointer, to a funcptr, or to an array.
# Note that casting to an array is an extension to the C language,
diff --git a/pypy/module/_cffi_backend/test/test_fastpath.py b/pypy/module/_cffi_backend/test/test_fastpath.py
--- a/pypy/module/_cffi_backend/test/test_fastpath.py
+++ b/pypy/module/_cffi_backend/test/test_fastpath.py
@@ -75,6 +75,16 @@
if not self.runappdirect:
assert self.get_count() == 1
+ def test_TypeError_if_no_length(self):
+ import _cffi_backend
+ LONG = _cffi_backend.new_primitive_type('long')
+ P_LONG = _cffi_backend.new_pointer_type(LONG)
+ LONG_ARRAY = _cffi_backend.new_array_type(P_LONG, 3)
+ buf = _cffi_backend.newp(LONG_ARRAY)
+ pbuf = _cffi_backend.cast(P_LONG, buf)
+ raises(TypeError, "list(pbuf)")
+
+
def test_list_float(self):
import _cffi_backend
DOUBLE = _cffi_backend.new_primitive_type('double')
More information about the pypy-commit
mailing list