[pypy-commit] pypy default: Improve the error messages

arigo noreply at buildbot.pypy.org
Wed Sep 19 01:09:48 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r57379:5c84521f68f5
Date: 2012-09-19 01:09 +0200
http://bitbucket.org/pypy/pypy/changeset/5c84521f68f5/

Log:	Improve the error messages

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
@@ -136,8 +136,11 @@
 
     def typeoffsetof(self, fieldname):
         space = self.space
-        raise OperationError(space.w_TypeError,
-                             space.wrap("not a struct or union ctype"))
+        if fieldname is None:
+            msg = "expected a struct or union ctype"
+        else:
+            msg = "expected a struct or union ctype, or a pointer to one"
+        raise OperationError(space.w_TypeError, space.wrap(msg))
 
     def _getfields(self):
         return None


More information about the pypy-commit mailing list