Author: mozbugbox <mozbug...@yahoo.com.au>
Branch: 
Changeset: r1484:3d11d62d6ed9
Date: 2014-04-01 08:16 +0800
http://bitbucket.org/cffi/cffi/changeset/3d11d62d6ed9/

Log:    Move try ... except outside of a for loop

diff --git a/cffi/cparser.py b/cffi/cparser.py
--- a/cffi/cparser.py
+++ b/cffi/cparser.py
@@ -182,8 +182,8 @@
             if decl.name == '__dotdotdot__':
                 break
         #
-        for decl in iterator:
-            try:
+        try:
+            for decl in iterator:
                 if isinstance(decl, pycparser.c_ast.Decl):
                     self._parse_decl(decl)
                 elif isinstance(decl, pycparser.c_ast.Typedef):
@@ -204,11 +204,11 @@
                     self._declare('typedef ' + decl.name, realtype)
                 else:
                     raise api.CDefError("unrecognized construct", decl)
-            except api.FFIError as e:
-                msg = self._convert_pycparser_error(e, csource)
-                if msg:
-                    print("*** Error: %s" % msg)
-                raise
+        except api.FFIError as e:
+            msg = self._convert_pycparser_error(e, csource)
+            if msg:
+                print("*** Error: %s" % msg)
+            raise
 
     def _parse_decl(self, decl):
         node = decl.type
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to