Commits

Antonio Cuni committed 0cffbb8

a failing test and the corresponding fix. I hate RPython, this corresponds to a segfault after translation :-/

Comments (0)

Files changed (2)

pypy/module/_cffi_backend/ctypeptr.py

     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,

pypy/module/_cffi_backend/test/test_fastpath.py

         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')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.