[pypy-commit] cffi default: Clearer error message.

arigo noreply at buildbot.pypy.org
Fri Jun 22 18:57:18 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r484:e0138cba7bbc
Date: 2012-06-22 18:56 +0200
http://bitbucket.org/cffi/cffi/changeset/e0138cba7bbc/

Log:	Clearer error message.

diff --git a/c/_ffi_backend.c b/c/_ffi_backend.c
--- a/c/_ffi_backend.c
+++ b/c/_ffi_backend.c
@@ -2002,8 +2002,11 @@
             write_raw_float_data(cd->c_data, value, ct->ct_size);
         return (PyObject *)cd;
     }
-    else
-        goto cannot_cast;
+    else {
+        PyErr_Format(PyExc_TypeError, "cannot cast to ctype '%s'",
+                     ct->ct_name);
+        return NULL;
+    }
 
  cannot_cast:
     if (CData_Check(ob))


More information about the pypy-commit mailing list