Author: Armin Rigo <[email protected]>
Branch: cffi-1.0
Changeset: r1740:0feb2cc57dcb
Date: 2015-04-17 16:49 +0200
http://bitbucket.org/cffi/cffi/changeset/0feb2cc57dcb/

Log:    test and fix

diff --git a/new/realize_c_type.c b/new/realize_c_type.c
--- a/new/realize_c_type.c
+++ b/new/realize_c_type.c
@@ -60,6 +60,8 @@
        decrefed, and 'y' never does.
     */
     CTypeDescrObject *ct = (CTypeDescrObject *)x;
+    if (ct == NULL)
+        return NULL;
 
     /* XXX maybe change the type of ct_name to be a real 'PyObject *'? */
     PyObject *name = PyString_FromString(ct->ct_name);
diff --git a/new/test_ffi_obj.py b/new/test_ffi_obj.py
--- a/new/test_ffi_obj.py
+++ b/new/test_ffi_obj.py
@@ -35,3 +35,8 @@
     t1 = ffi1.typeof("int *")
     t2 = ffi2.typeof("int *")
     assert t1 is t2
+
+def test_ffi_invalid():
+    ffi = _cffi1_backend.FFI()
+    # array of 10 times an "int[]" is invalid
+    py.test.raises(ValueError, ffi.typeof, "int[10][]")
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to