[pypy-commit] pypy default: test and fix

arigo noreply at buildbot.pypy.org
Thu Oct 24 08:25:53 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r67546:deb9af94dcc2
Date: 2013-10-24 08:25 +0200
http://bitbucket.org/pypy/pypy/changeset/deb9af94dcc2/

Log:	test and fix

diff --git a/pypy/module/_cffi_backend/ctypeobj.py b/pypy/module/_cffi_backend/ctypeobj.py
--- a/pypy/module/_cffi_backend/ctypeobj.py
+++ b/pypy/module/_cffi_backend/ctypeobj.py
@@ -49,6 +49,12 @@
     def is_double(self):
         return False
 
+    def aslist_int(self, w_ob):
+        return None
+
+    def aslist_float(self, w_ob):
+        return None
+
     def newp(self, w_init):
         space = self.space
         raise operationerrfmt(space.w_TypeError,
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
@@ -34,6 +34,15 @@
         assert buf[1] == 2.2
         assert buf[2] == 3.3
 
+    def test_bug(self):
+        import _cffi_backend
+        LONG = _cffi_backend.new_primitive_type('long')
+        five = _cffi_backend.cast(LONG, 5)
+        raises(TypeError, list, five)
+        DOUBLE = _cffi_backend.new_primitive_type('double')
+        five_and_a_half = _cffi_backend.cast(DOUBLE, 5.5)
+        raises(TypeError, list, five_and_a_half)
+
 
 class AppTest_fast_path_to_list(object):
     spaceconfig = dict(usemodules=('_cffi_backend', 'cStringIO'))


More information about the pypy-commit mailing list