[pypy-commit] pypy default: Move code one more level down

rlamy pypy.commits at gmail.com
Fri Jan 20 14:38:06 EST 2017


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: 
Changeset: r89681:8c8c83bfd69b
Date: 2017-01-20 19:37 +0000
http://bitbucket.org/pypy/pypy/changeset/8c8c83bfd69b/

Log:	Move code one more level down

diff --git a/pypy/module/cpyext/cparser.py b/pypy/module/cpyext/cparser.py
--- a/pypy/module/cpyext/cparser.py
+++ b/pypy/module/cpyext/cparser.py
@@ -347,14 +347,12 @@
         if isinstance(typenode, pycparser.c_ast.TypeDecl):
             quals = self._extract_quals(typenode)
             type = typenode.type
-            # first, dereference typedefs, if we have it already parsed, we're good
-            if (isinstance(type, pycparser.c_ast.IdentifierType) and
-                len(type.names) == 1 and
-                ('typedef ' + type.names[0]) in self._declarations):
-                tp, base_quals = self._declarations['typedef ' + type.names[0]]
-                quals |= base_quals
-                return tp, quals
             if isinstance(type, pycparser.c_ast.IdentifierType):
+                # first, dereference typedefs, if we have it already parsed, we're good
+                if (len(type.names) == 1 and
+                    ('typedef ' + type.names[0]) in self._declarations):
+                    tp0, quals0 = self._declarations['typedef ' + type.names[0]]
+                    return tp0, (quals | quals0)
                 # assume a primitive type.  get it from .names, but reduce
                 # synonyms to a single chosen combination
                 names = list(type.names)


More information about the pypy-commit mailing list