[pypy-commit] pypy typed-cells: merge default

cfbolz pypy.commits at gmail.com
Fri Jan 15 02:33:25 EST 2016


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: typed-cells
Changeset: r81776:07be65d4b6c9
Date: 2016-01-15 08:32 +0100
http://bitbucket.org/pypy/pypy/changeset/07be65d4b6c9/

Log:	merge default

diff too long, truncating to 2000 out of 130117 lines

diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,14 @@
 .hg
 .svn
 
+# VIM
+*.swp
+*.swo
+
 *.pyc
 *.pyo
 *~
+__pycache__/
 
 bin/pypy-c
 include/*.h
@@ -22,4 +27,6 @@
 pypy/translator/goal/pypy-c
 pypy/translator/goal/target*-c
 release/
+!pypy/tool/release/
 rpython/_cache/
+.cache/
diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -15,3 +15,6 @@
 e03971291f3a0729ecd3ee7fae7ddb0bb82d476c release-2.6.0
 e03971291f3a0729ecd3ee7fae7ddb0bb82d476c release-2.6.0
 295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0
+f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1
+850edf14b2c75573720f59e95767335fb1affe55 release-4.0.0
+5f8302b8bf9f53056e40426f10c72151564e5b19 release-4.0.1
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -28,7 +28,7 @@
     DEALINGS IN THE SOFTWARE.
 
 
-PyPy Copyright holders 2003-2015
+PyPy Copyright holders 2003-2016
 ----------------------------------- 
 
 Except when otherwise stated (look for LICENSE files or information at
@@ -56,14 +56,15 @@
   Anders Chrigstrom
   Eric van Riet Paap
   Wim Lavrijsen
+  Richard Plangger
   Richard Emslie
   Alexander Schremmer
   Dan Villiom Podlaski Christiansen
   Lukas Diekmann
   Sven Hager
   Anders Lehmann
+  Remi Meier
   Aurelien Campeas
-  Remi Meier
   Niklaus Haldimann
   Camillo Bruni
   Laura Creighton
@@ -87,7 +88,6 @@
   Ludovic Aubry
   Jacob Hallen
   Jason Creighton
-  Richard Plangger
   Alex Martelli
   Michal Bendowski
   stian
@@ -168,7 +168,6 @@
   Michael Twomey
   Lucian Branescu Mihaila
   Yichao Yu
-  Anton Gulenko
   Gabriel Lavoie
   Olivier Dormond
   Jared Grubb
@@ -201,9 +200,12 @@
   Alex Perry
   Vincent Legoll
   Alan McIntyre
+  Spenser Bauman
   Alexander Sedov
   Attila Gobi
   Christopher Pope
+  Devin Jeanpierre
+  Vaibhav Sood
   Christian Tismer 
   Marc Abramowitz
   Dan Stromberg
@@ -215,6 +217,7 @@
   Carl Meyer
   Karl Ramm
   Pieter Zieschang
+  Anton Gulenko
   Gabriel
   Lukas Vacek
   Andrew Dalke
@@ -234,6 +237,7 @@
   Lutz Paelike
   Lucio Torre
   Lars Wassermann
+  Philipp Rustemeuer
   Henrik Vendelbo
   Dan Buch
   Miguel de Val Borro
@@ -244,14 +248,17 @@
   Martin Blais
   Lene Wagner
   Tomo Cocoa
+  Kim Jin Su
   Toni Mattis
   Lucas Stadler
   Julian Berman
+  Markus Holtermann
   roberto at goyle
   Yury V. Zaytsev
   Anna Katrina Dominguez
   William Leslie
   Bobby Impollonia
+  Faye Zhao
   timo at eistee.fritz.box
   Andrew Thompson
   Yusei Tahara
@@ -282,6 +289,7 @@
   shoma hosaka
   Daniel Neuhäuser
   Ben Mather
+  Niclas Olofsson
   halgari
   Boglarka Vezer
   Chris Pressey
@@ -308,13 +316,16 @@
   Stefan Marr
   jiaaro
   Mads Kiilerich
+  Richard Lancaster
   opassembler.py
   Antony Lee
+  Yaroslav Fedevych
   Jim Hunziker
   Markus Unterwaditzer
   Even Wiik Thomassen
   jbs
   squeaky
+  Zearin
   soareschen
   Kurt Griffiths
   Mike Bayer
@@ -326,6 +337,7 @@
   Anna Ravencroft
   Andrey Churin
   Dan Crosta
+  Tobias Diaz
   Julien Phalip
   Roman Podoliaka
   Dan Loewenherz
@@ -352,8 +364,7 @@
 Except when otherwise stated (look for LICENSE files or copyright/license
 information at the beginning of each file) the files in the 'lib-python/2.7'
 directory are all copyrighted by the Python Software Foundation and licensed
-under the Python Software License of which you can find a copy here:
-http://www.python.org/doc/Copyright.html 
+under the terms that you can find here: https://docs.python.org/2/license.html
 
 License for 'pypy/module/unicodedata/'
 ======================================
@@ -430,9 +441,9 @@
 gdbm module, provided in the file lib_pypy/gdbm.py, is redistributed
 under the terms of the GPL license as well.
 
-License for 'pypy/module/_vmprof/src'
+License for 'rpython/rlib/rvmprof/src'
 --------------------------------------
 
 The code is based on gperftools. You may see a copy of the License for it at
 
-    https://code.google.com/p/gperftools/source/browse/COPYING
+    https://github.com/gperftools/gperftools/blob/master/COPYING
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 
-all: pypy-c
+all: pypy-c cffi_imports
 
 PYPY_EXECUTABLE := $(shell which pypy)
 URAM := $(shell python -c "import sys; print 4.5 if sys.maxint>1<<32 else 2.5")
@@ -10,6 +10,8 @@
 RUNINTERP = $(PYPY_EXECUTABLE)
 endif
 
+.PHONY: cffi_imports
+
 pypy-c:
 	@echo
 	@echo "===================================================================="
@@ -36,3 +38,6 @@
 # replaced with an opaque --jobserver option by the time this Makefile
 # runs.  We cannot get their original value either:
 # http://lists.gnu.org/archive/html/help-make/2010-08/msg00106.html
+
+cffi_imports: pypy-c
+	PYTHONPATH=. ./pypy-c pypy/tool/build_cffi_imports.py
diff --git a/_pytest/assertion/rewrite.py b/_pytest/assertion/rewrite.py
--- a/_pytest/assertion/rewrite.py
+++ b/_pytest/assertion/rewrite.py
@@ -308,7 +308,10 @@
         if (len(data) != 8 or data[:4] != imp.get_magic() or
                 struct.unpack("<l", data[4:])[0] != mtime):
             return None
-        co = marshal.load(fp)
+        try:
+            co = marshal.load(fp)
+        except ValueError:
+            return None # e.g. bad marshal data because of pypy/cpython mix
         if not isinstance(co, types.CodeType):
             # That's interesting....
             return None
diff --git a/dotviewer/graphclient.py b/dotviewer/graphclient.py
--- a/dotviewer/graphclient.py
+++ b/dotviewer/graphclient.py
@@ -127,16 +127,8 @@
         return spawn_graphserver_handler((host, port))
 
 def spawn_local_handler():
-    if hasattr(sys, 'pypy_objspaceclass'):
-        # if 'python' is actually PyPy, e.g. in a virtualenv, then
-        # try hard to find a real CPython
-        try:
-            python = subprocess.check_output(
-                'env -i $SHELL -l -c "which python"', shell=True).strip()
-        except subprocess.CalledProcessError:
-            # did not work, fall back to 'python'
-            python = 'python'
-    else:
+    python = os.getenv('PYPY_PYGAME_PYTHON')
+    if not python:
         python = sys.executable
     args = [python, '-u', GRAPHSERVER, '--stdio']
     p = subprocess.Popen(args,
diff --git a/lib-python/2.7/collections.py b/lib-python/2.7/collections.py
--- a/lib-python/2.7/collections.py
+++ b/lib-python/2.7/collections.py
@@ -18,9 +18,9 @@
     assert '__pypy__' not in _sys.builtin_module_names
     newdict = lambda _ : {}
 try:
-    from __pypy__ import reversed_dict
+    from __pypy__ import reversed_dict as _reversed_dict
 except ImportError:
-    reversed_dict = lambda d: reversed(d.keys())
+    _reversed_dict = None     # don't have ordered dicts
 
 try:
     from thread import get_ident as _get_ident
@@ -46,7 +46,7 @@
     '''
 
     def __reversed__(self):
-        return reversed_dict(self)
+        return _reversed_dict(self)
 
     def popitem(self, last=True):
         '''od.popitem() -> (k, v), return and remove a (key, value) pair.
@@ -116,6 +116,178 @@
         return ItemsView(self)
 
 
+def _compat_with_unordered_dicts():
+    # This returns the methods needed in OrderedDict in case the base
+    # 'dict' class is not actually ordered, like on top of CPython or
+    # old PyPy or PyPy-STM.
+
+    # ===== Original comments and code follows      =====
+    # ===== The unmodified methods are not repeated =====
+
+    # An inherited dict maps keys to values.
+    # The inherited dict provides __getitem__, __len__, __contains__, and get.
+    # The remaining methods are order-aware.
+    # Big-O running times for all methods are the same as regular dictionaries.
+
+    # The internal self.__map dict maps keys to links in a doubly linked list.
+    # The circular doubly linked list starts and ends with a sentinel element.
+    # The sentinel element never gets deleted (this simplifies the algorithm).
+    # Each link is stored as a list of length three:  [PREV, NEXT, KEY].
+
+    def __init__(self, *args, **kwds):
+        '''Initialize an ordered dictionary.  The signature is the same as
+        regular dictionaries, but keyword arguments are not recommended because
+        their insertion order is arbitrary.
+
+        '''
+        if len(args) > 1:
+            raise TypeError('expected at most 1 arguments, got %d' % len(args))
+        try:
+            self.__root
+        except AttributeError:
+            self.__root = root = []                     # sentinel node
+            root[:] = [root, root, None]
+            self.__map = {}
+        self.__update(*args, **kwds)
+
+    def __setitem__(self, key, value, dict_setitem=dict.__setitem__):
+        'od.__setitem__(i, y) <==> od[i]=y'
+        # Setting a new item creates a new link at the end of the linked list,
+        # and the inherited dictionary is updated with the new key/value pair.
+        if key not in self:
+            root = self.__root
+            last = root[0]
+            last[1] = root[0] = self.__map[key] = [last, root, key]
+        return dict_setitem(self, key, value)
+
+    def __delitem__(self, key, dict_delitem=dict.__delitem__):
+        'od.__delitem__(y) <==> del od[y]'
+        # Deleting an existing item uses self.__map to find the link which gets
+        # removed by updating the links in the predecessor and successor nodes.
+        dict_delitem(self, key)
+        link_prev, link_next, _ = self.__map.pop(key)
+        link_prev[1] = link_next                        # update link_prev[NEXT]
+        link_next[0] = link_prev                        # update link_next[PREV]
+
+    def __iter__(self):
+        'od.__iter__() <==> iter(od)'
+        # Traverse the linked list in order.
+        root = self.__root
+        curr = root[1]                                  # start at the first node
+        while curr is not root:
+            yield curr[2]                               # yield the curr[KEY]
+            curr = curr[1]                              # move to next node
+
+    def __reversed__(self):
+        'od.__reversed__() <==> reversed(od)'
+        # Traverse the linked list in reverse order.
+        root = self.__root
+        curr = root[0]                                  # start at the last node
+        while curr is not root:
+            yield curr[2]                               # yield the curr[KEY]
+            curr = curr[0]                              # move to previous node
+
+    def clear(self):
+        'od.clear() -> None.  Remove all items from od.'
+        root = self.__root
+        root[:] = [root, root, None]
+        self.__map.clear()
+        dict.clear(self)
+
+    # -- the following methods do not depend on the internal structure --
+
+    def keys(self):
+        'od.keys() -> list of keys in od'
+        return list(self)
+
+    def values(self):
+        'od.values() -> list of values in od'
+        return [self[key] for key in self]
+
+    def items(self):
+        'od.items() -> list of (key, value) pairs in od'
+        return [(key, self[key]) for key in self]
+
+    def iterkeys(self):
+        'od.iterkeys() -> an iterator over the keys in od'
+        return iter(self)
+
+    def itervalues(self):
+        'od.itervalues -> an iterator over the values in od'
+        for k in self:
+            yield self[k]
+
+    def iteritems(self):
+        'od.iteritems -> an iterator over the (key, value) pairs in od'
+        for k in self:
+            yield (k, self[k])
+
+    update = MutableMapping.update
+
+    __update = update # let subclasses override update without breaking __init__
+
+    __marker = object()
+
+    def pop(self, key, default=__marker):
+        '''od.pop(k[,d]) -> v, remove specified key and return the corresponding
+        value.  If key is not found, d is returned if given, otherwise KeyError
+        is raised.
+
+        '''
+        if key in self:
+            result = self[key]
+            del self[key]
+            return result
+        if default is self.__marker:
+            raise KeyError(key)
+        return default
+
+    def setdefault(self, key, default=None):
+        'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od'
+        if key in self:
+            return self[key]
+        self[key] = default
+        return default
+
+    def popitem(self, last=True):
+        '''od.popitem() -> (k, v), return and remove a (key, value) pair.
+        Pairs are returned in LIFO order if last is true or FIFO order if false.
+
+        '''
+        if not self:
+            raise KeyError('dictionary is empty')
+        key = next(reversed(self) if last else iter(self))
+        value = self.pop(key)
+        return key, value
+
+    def __reduce__(self):
+        'Return state information for pickling'
+        items = [[k, self[k]] for k in self]
+        inst_dict = vars(self).copy()
+        for k in vars(OrderedDict()):
+            inst_dict.pop(k, None)
+        if inst_dict:
+            return (self.__class__, (items,), inst_dict)
+        return self.__class__, (items,)
+
+    @classmethod
+    def fromkeys(cls, iterable, value=None):
+        '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S.
+        If not specified, the value defaults to None.
+
+        '''
+        self = cls()
+        for key in iterable:
+            self[key] = value
+        return self
+
+    return locals()
+
+if _reversed_dict is None:
+    for _key, _value in _compat_with_unordered_dicts().items():
+        setattr(OrderedDict, _key, _value)
+    del _key, _value
+
 ################################################################################
 ### namedtuple
 ################################################################################
diff --git a/lib-python/2.7/json/encoder.py b/lib-python/2.7/json/encoder.py
--- a/lib-python/2.7/json/encoder.py
+++ b/lib-python/2.7/json/encoder.py
@@ -8,13 +8,13 @@
     def __init__(self):
         self._builder = StringBuilder()
     def append(self, string):
-        try:
-            self._builder.append(string)
-        except UnicodeEncodeError:
+        if (isinstance(string, unicode) and
+                type(self._builder) is StringBuilder):
             ub = UnicodeBuilder()
             ub.append(self._builder.build())
             self._builder = ub
-            ub.append(string)
+            self.append = ub.append   # shortcut only
+        self._builder.append(string)
     def build(self):
         return self._builder.build()
 
diff --git a/lib-python/2.7/pickle.py b/lib-python/2.7/pickle.py
--- a/lib-python/2.7/pickle.py
+++ b/lib-python/2.7/pickle.py
@@ -1376,6 +1376,7 @@
 
 def decode_long(data):
     r"""Decode a long from a two's complement little-endian binary string.
+    This is overriden on PyPy by a RPython version that has linear complexity.
 
     >>> decode_long('')
     0L
@@ -1402,6 +1403,11 @@
         n -= 1L << (nbytes * 8)
     return n
 
+try:
+    from __pypy__ import decode_long
+except ImportError:
+    pass
+
 # Shorthands
 
 try:
diff --git a/lib-python/2.7/sysconfig.py b/lib-python/2.7/sysconfig.py
--- a/lib-python/2.7/sysconfig.py
+++ b/lib-python/2.7/sysconfig.py
@@ -524,6 +524,13 @@
             import _osx_support
             _osx_support.customize_config_vars(_CONFIG_VARS)
 
+        # PyPy:
+        import imp
+        for suffix, mode, type_ in imp.get_suffixes():
+            if type_ == imp.C_EXTENSION:
+                _CONFIG_VARS['SOABI'] = suffix.split('.')[1]
+                break
+
     if args:
         vals = []
         for name in args:
diff --git a/lib-python/2.7/uuid.py b/lib-python/2.7/uuid.py
--- a/lib-python/2.7/uuid.py
+++ b/lib-python/2.7/uuid.py
@@ -604,21 +604,8 @@
 
 def uuid4():
     """Generate a random UUID."""
-
-    # When the system provides a version-4 UUID generator, use it.
-    if _uuid_generate_random:
-        _buffer = ctypes.create_string_buffer(16)
-        _uuid_generate_random(_buffer)
-        return UUID(bytes=_buffer.raw)
-
-    # Otherwise, get randomness from urandom or the 'random' module.
-    try:
-        import os
-        return UUID(bytes=os.urandom(16), version=4)
-    except:
-        import random
-        bytes = [chr(random.randrange(256)) for i in range(16)]
-        return UUID(bytes=bytes, version=4)
+    import os
+    return UUID(bytes=os.urandom(16), version=4)
 
 def uuid5(namespace, name):
     """Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
diff --git a/lib-python/conftest.py b/lib-python/conftest.py
--- a/lib-python/conftest.py
+++ b/lib-python/conftest.py
@@ -158,7 +158,7 @@
     RegrTest('test_codecs.py', core=True, usemodules='_multibytecodec'),
     RegrTest('test_codeop.py', core=True),
     RegrTest('test_coding.py', core=True),
-    RegrTest('test_coercion.py', core=True),
+    RegrTest('test_coercion.py', core=True, usemodules='struct'),
     RegrTest('test_collections.py', usemodules='binascii struct'),
     RegrTest('test_colorsys.py'),
     RegrTest('test_commands.py'),
@@ -303,7 +303,7 @@
     RegrTest('test_memoryio.py'),
     RegrTest('test_memoryview.py'),
     RegrTest('test_md5.py'),
-    RegrTest('test_mhlib.py'),
+    RegrTest('test_mhlib.py', usemodules='binascii struct'),
     RegrTest('test_mimetools.py'),
     RegrTest('test_mimetypes.py'),
     RegrTest('test_MimeWriter.py', core=False, usemodules='binascii'),
diff --git a/lib_pypy/_curses.py b/lib_pypy/_curses.py
--- a/lib_pypy/_curses.py
+++ b/lib_pypy/_curses.py
@@ -1026,16 +1026,22 @@
 
 def tigetflag(capname):
     _ensure_initialised_setupterm()
+    if isinstance(capname, unicode):
+        capname = capname.encode('ascii')
     return lib.tigetflag(capname)
 
 
 def tigetnum(capname):
     _ensure_initialised_setupterm()
+    if isinstance(capname, unicode):
+        capname = capname.encode('ascii')
     return lib.tigetnum(capname)
 
 
 def tigetstr(capname):
     _ensure_initialised_setupterm()
+    if isinstance(capname, unicode):
+        capname = capname.encode('ascii')
     val = lib.tigetstr(capname)
     if int(ffi.cast("intptr_t", val)) in (0, -1):
         return None
diff --git a/lib_pypy/_tkinter/tklib_build.py b/lib_pypy/_tkinter/tklib_build.py
--- a/lib_pypy/_tkinter/tklib_build.py
+++ b/lib_pypy/_tkinter/tklib_build.py
@@ -212,8 +212,8 @@
 #include <tclTomMath.h>
 #endif 
 
-char *get_tk_version() { return TK_VERSION; }
-char *get_tcl_version() { return TCL_VERSION; }
+char *get_tk_version(void) { return TK_VERSION; }
+char *get_tcl_version(void) { return TCL_VERSION; }
 """ % globals(),
 include_dirs=incdirs,
 libraries=linklibs,
diff --git a/lib_pypy/cPickle.py b/lib_pypy/cPickle.py
--- a/lib_pypy/cPickle.py
+++ b/lib_pypy/cPickle.py
@@ -167,7 +167,11 @@
         try:
             key = ord(self.read(1))
             while key != STOP:
-                self.dispatch[key](self)
+                try:
+                    meth = self.dispatch[key]
+                except KeyError:
+                    raise UnpicklingError("invalid load key, %r." % chr(key))
+                meth(self)
                 key = ord(self.read(1))
         except TypeError:
             if self.read(1) == '':
@@ -559,6 +563,7 @@
 
 def decode_long(data):
     r"""Decode a long from a two's complement little-endian binary string.
+    This is overriden on PyPy by a RPython version that has linear complexity.
 
     >>> decode_long('')
     0L
@@ -592,6 +597,11 @@
         n -= 1L << (nbytes << 3)
     return n
 
+try:
+    from __pypy__ import decode_long
+except ImportError:
+    pass
+
 def load(f):
     return Unpickler(f).load()
 
diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO
--- a/lib_pypy/cffi.egg-info/PKG-INFO
+++ b/lib_pypy/cffi.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: cffi
-Version: 1.2.0
+Version: 1.4.2
 Summary: Foreign Function Interface for Python calling C code.
 Home-page: http://cffi.readthedocs.org
 Author: Armin Rigo, Maciej Fijalkowski
diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py
--- a/lib_pypy/cffi/__init__.py
+++ b/lib_pypy/cffi/__init__.py
@@ -4,8 +4,8 @@
 from .api import FFI, CDefError, FFIError
 from .ffiplatform import VerificationError, VerificationMissing
 
-__version__ = "1.2.0"
-__version_info__ = (1, 2, 0)
+__version__ = "1.4.2"
+__version_info__ = (1, 4, 2)
 
 # The verifier module file names are based on the CRC32 of a string that
 # contains the following version number.  It may be older than __version__
diff --git a/lib_pypy/cffi/_cffi_include.h b/lib_pypy/cffi/_cffi_include.h
--- a/lib_pypy/cffi/_cffi_include.h
+++ b/lib_pypy/cffi/_cffi_include.h
@@ -46,7 +46,7 @@
 # endif
 #else
 # include <stdint.h>
-# if (defined (__SVR4) && defined (__sun)) || defined(_AIX)
+# if (defined (__SVR4) && defined (__sun)) || defined(_AIX) || defined(__hpux)
 #  include <alloca.h>
 # endif
 #endif
@@ -146,7 +146,9 @@
     ((Py_ssize_t(*)(CTypeDescrObject *, PyObject *, char **))_cffi_exports[23])
 #define _cffi_convert_array_from_object                                  \
     ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[24])
-#define _CFFI_NUM_EXPORTS 25
+#define _cffi_call_python                                                \
+    ((void(*)(struct _cffi_externpy_s *, char *))_cffi_exports[25])
+#define _CFFI_NUM_EXPORTS 26
 
 typedef struct _ctypedescr CTypeDescrObject;
 
@@ -201,8 +203,11 @@
                                                   the others follow */
 }
 
+/**********  end CPython-specific section  **********/
+#else
+_CFFI_UNUSED_FN
+static void (*_cffi_call_python)(struct _cffi_externpy_s *, char *);
 #endif
-/**********  end CPython-specific section  **********/
 
 
 #define _cffi_array_len(array)   (sizeof(array) / sizeof((array)[0]))
@@ -214,6 +219,12 @@
      (size) == 8 ? ((sign) ? _CFFI_PRIM_INT64 : _CFFI_PRIM_UINT64) :    \
      _CFFI__UNKNOWN_PRIM)
 
+#define _cffi_prim_float(size)                                          \
+    ((size) == sizeof(float) ? _CFFI_PRIM_FLOAT :                       \
+     (size) == sizeof(double) ? _CFFI_PRIM_DOUBLE :                     \
+     (size) == sizeof(long double) ? _CFFI__UNKNOWN_LONG_DOUBLE :       \
+     _CFFI__UNKNOWN_FLOAT_PRIM)
+
 #define _cffi_check_int(got, got_nonpos, expected)      \
     ((got_nonpos) == (expected <= 0) &&                 \
      (got) == (unsigned long long)expected)
diff --git a/lib_pypy/cffi/_pycparser/__init__.py b/lib_pypy/cffi/_pycparser/__init__.py
--- a/lib_pypy/cffi/_pycparser/__init__.py
+++ b/lib_pypy/cffi/_pycparser/__init__.py
@@ -4,11 +4,11 @@
 # This package file exports some convenience functions for
 # interacting with pycparser
 #
-# Copyright (C) 2008-2012, Eli Bendersky
+# Copyright (C) 2008-2015, Eli Bendersky
 # License: BSD
 #-----------------------------------------------------------------
 __all__ = ['c_lexer', 'c_parser', 'c_ast']
-__version__ = '2.10'
+__version__ = '2.14'
 
 from subprocess import Popen, PIPE
 from .c_parser import CParser
@@ -91,4 +91,3 @@
     if parser is None:
         parser = CParser()
     return parser.parse(text, filename)
-
diff --git a/lib_pypy/cffi/_pycparser/_ast_gen.py b/lib_pypy/cffi/_pycparser/_ast_gen.py
--- a/lib_pypy/cffi/_pycparser/_ast_gen.py
+++ b/lib_pypy/cffi/_pycparser/_ast_gen.py
@@ -1,13 +1,13 @@
 #-----------------------------------------------------------------
 # _ast_gen.py
 #
-# Generates the AST Node classes from a specification given in 
-# a .yaml file
+# Generates the AST Node classes from a specification given in
+# a configuration file
 #
 # The design of this module was inspired by astgen.py from the
 # Python 2.5 code-base.
 #
-# Copyright (C) 2008-2012, Eli Bendersky
+# Copyright (C) 2008-2015, Eli Bendersky
 # License: BSD
 #-----------------------------------------------------------------
 import pprint
@@ -20,7 +20,7 @@
             file.
         """
         self.cfg_filename = cfg_filename
-        self.node_cfg = [NodeCfg(name, contents) 
+        self.node_cfg = [NodeCfg(name, contents)
             for (name, contents) in self.parse_cfgfile(cfg_filename)]
 
     def generate(self, file=None):
@@ -28,11 +28,11 @@
         """
         src = Template(_PROLOGUE_COMMENT).substitute(
             cfg_filename=self.cfg_filename)
-        
+
         src += _PROLOGUE_CODE
         for node_cfg in self.node_cfg:
             src += node_cfg.generate_source() + '\n\n'
-        
+
         file.write(src)
 
     def parse_cfgfile(self, filename):
@@ -57,10 +57,10 @@
 
 
 class NodeCfg(object):
-    """ Node configuration. 
+    """ Node configuration.
 
         name: node name
-        contents: a list of contents - attributes and child nodes 
+        contents: a list of contents - attributes and child nodes
         See comment at the top of the configuration file for details.
     """
     def __init__(self, name, contents):
@@ -73,7 +73,7 @@
         for entry in contents:
             clean_entry = entry.rstrip('*')
             self.all_entries.append(clean_entry)
-            
+
             if entry.endswith('**'):
                 self.seq_child.append(clean_entry)
             elif entry.endswith('*'):
@@ -86,26 +86,30 @@
         src += '\n' + self._gen_children()
         src += '\n' + self._gen_attr_names()
         return src
-    
+
     def _gen_init(self):
         src = "class %s(Node):\n" % self.name
 
         if self.all_entries:
             args = ', '.join(self.all_entries)
+            slots = ', '.join("'{0}'".format(e) for e in self.all_entries)
+            slots += ", 'coord', '__weakref__'"
             arglist = '(self, %s, coord=None)' % args
         else:
+            slots = "'coord', '__weakref__'"
             arglist = '(self, coord=None)'
-        
+
+        src += "    __slots__ = (%s)\n" % slots
         src += "    def __init__%s:\n" % arglist
-        
+
         for name in self.all_entries + ['coord']:
             src += "        self.%s = %s\n" % (name, name)
-        
+
         return src
 
     def _gen_children(self):
         src = '    def children(self):\n'
-        
+
         if self.all_entries:
             src += '        nodelist = []\n'
 
@@ -114,21 +118,21 @@
                     '        if self.%(child)s is not None:' +
                     ' nodelist.append(("%(child)s", self.%(child)s))\n') % (
                         dict(child=child))
-                
+
             for seq_child in self.seq_child:
                 src += (
                     '        for i, child in enumerate(self.%(child)s or []):\n'
                     '            nodelist.append(("%(child)s[%%d]" %% i, child))\n') % (
                         dict(child=seq_child))
-                    
+
             src += '        return tuple(nodelist)\n'
         else:
             src += '        return ()\n'
-            
-        return src        
+
+        return src
 
     def _gen_attr_names(self):
-        src = "    attr_names = (" + ''.join("%r," % nm for nm in self.attr) + ')' 
+        src = "    attr_names = (" + ''.join("%r, " % nm for nm in self.attr) + ')'
         return src
 
 
@@ -136,7 +140,7 @@
 r'''#-----------------------------------------------------------------
 # ** ATTENTION **
 # This code was automatically generated from the file:
-# $cfg_filename 
+# $cfg_filename
 #
 # Do not modify it directly. Modify the configuration file and
 # run the generator again.
@@ -146,7 +150,7 @@
 #
 # AST Node classes.
 #
-# Copyright (C) 2008-2012, Eli Bendersky
+# Copyright (C) 2008-2015, Eli Bendersky
 # License: BSD
 #-----------------------------------------------------------------
 
@@ -157,6 +161,7 @@
 
 
 class Node(object):
+    __slots__ = ()
     """ Abstract base class for AST nodes.
     """
     def children(self):
@@ -167,21 +172,21 @@
     def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None):
         """ Pretty print the Node and all its attributes and
             children (recursively) to a buffer.
-            
-            buf:   
+
+            buf:
                 Open IO buffer into which the Node is printed.
-            
-            offset: 
-                Initial offset (amount of leading spaces) 
-            
+
+            offset:
+                Initial offset (amount of leading spaces)
+
             attrnames:
                 True if you want to see the attribute names in
                 name=value pairs. False to only see the values.
-                
+
             nodenames:
-                True if you want to see the actual node names 
+                True if you want to see the actual node names
                 within their parents.
-            
+
             showcoord:
                 Do you want the coordinates of each Node to be
                 displayed.
@@ -216,47 +221,47 @@
 
 
 class NodeVisitor(object):
-    """ A base NodeVisitor class for visiting c_ast nodes. 
+    """ A base NodeVisitor class for visiting c_ast nodes.
         Subclass it and define your own visit_XXX methods, where
-        XXX is the class name you want to visit with these 
+        XXX is the class name you want to visit with these
         methods.
-        
+
         For example:
-        
+
         class ConstantVisitor(NodeVisitor):
             def __init__(self):
                 self.values = []
-            
+
             def visit_Constant(self, node):
                 self.values.append(node.value)
 
-        Creates a list of values of all the constant nodes 
+        Creates a list of values of all the constant nodes
         encountered below the given node. To use it:
-        
+
         cv = ConstantVisitor()
         cv.visit(node)
-        
+
         Notes:
-        
-        *   generic_visit() will be called for AST nodes for which 
-            no visit_XXX method was defined. 
-        *   The children of nodes for which a visit_XXX was 
+
+        *   generic_visit() will be called for AST nodes for which
+            no visit_XXX method was defined.
+        *   The children of nodes for which a visit_XXX was
             defined will not be visited - if you need this, call
-            generic_visit() on the node. 
+            generic_visit() on the node.
             You can use:
                 NodeVisitor.generic_visit(self, node)
         *   Modeled after Python's own AST visiting facilities
             (the ast module of Python 3.0)
     """
     def visit(self, node):
-        """ Visit a node. 
+        """ Visit a node.
         """
         method = 'visit_' + node.__class__.__name__
         visitor = getattr(self, method, self.generic_visit)
         return visitor(node)
-        
+
     def generic_visit(self, node):
-        """ Called if no explicit visitor function exists for a 
+        """ Called if no explicit visitor function exists for a
             node. Implements preorder visiting of the node.
         """
         for c_name, c in node.children():
diff --git a/lib_pypy/cffi/_pycparser/_build_tables.py b/lib_pypy/cffi/_pycparser/_build_tables.py
--- a/lib_pypy/cffi/_pycparser/_build_tables.py
+++ b/lib_pypy/cffi/_pycparser/_build_tables.py
@@ -6,12 +6,11 @@
 # Also generates AST code from the configuration file.
 # Should be called from the pycparser directory.
 #
-# Copyright (C) 2008-2012, Eli Bendersky
+# Copyright (C) 2008-2015, Eli Bendersky
 # License: BSD
 #-----------------------------------------------------------------
 
 # Generate c_ast.py
-#
 from _ast_gen import ASTCodeGenerator
 ast_gen = ASTCodeGenerator('_c_ast.cfg')
 ast_gen.generate(open('c_ast.py', 'w'))
diff --git a/lib_pypy/cffi/_pycparser/_c_ast.cfg b/lib_pypy/cffi/_pycparser/_c_ast.cfg
--- a/lib_pypy/cffi/_pycparser/_c_ast.cfg
+++ b/lib_pypy/cffi/_pycparser/_c_ast.cfg
@@ -1,188 +1,189 @@
-#-----------------------------------------------------------------
-# pycparser: _c_ast_gen.cfg
-#
-# Defines the AST Node classes used in pycparser.
-# 
-# Each entry is a Node sub-class name, listing the attributes
-# and child nodes of the class:
-#   <name>*     - a child node
-#   <name>**    - a sequence of child nodes
-#   <name>      - an attribute
-#
-# Copyright (C) 2008-2012, Eli Bendersky
-# License: BSD
-#-----------------------------------------------------------------
-
-ArrayDecl: [type*, dim*]
-
-ArrayRef: [name*, subscript*]
-
-# op: =, +=, /= etc.
-#
-Assignment: [op, lvalue*, rvalue*]
-
-BinaryOp: [op, left*, right*]
-
-Break: []
-
-Case: [expr*, stmts**]
-
-Cast: [to_type*, expr*]
-
-# Compound statement in C99 is a list of block items (declarations or
-# statements).
-#
-Compound: [block_items**]
-
-# Compound literal (anonymous aggregate) for C99.
-# (type-name) {initializer_list}
-# type: the typename
-# init: InitList for the initializer list
-#
-CompoundLiteral: [type*, init*]
-
-# type: int, char, float, etc. see CLexer for constant token types
-#
-Constant: [type, value]
-
-Continue: []
-
-# name: the variable being declared
-# quals: list of qualifiers (const, volatile)
-# funcspec: list function specifiers (i.e. inline in C99)
-# storage: list of storage specifiers (extern, register, etc.)
-# type: declaration type (probably nested with all the modifiers)
-# init: initialization value, or None
-# bitsize: bit field size, or None
-#
-Decl: [name, quals, storage, funcspec, type*, init*, bitsize*]
-
-DeclList: [decls**]
-
-Default: [stmts**]
-
-DoWhile: [cond*, stmt*]
-
-# Represents the ellipsis (...) parameter in a function 
-# declaration
-#
-EllipsisParam: []
-
-# An empty statement (a semicolon ';' on its own)
-#
-EmptyStatement: []
-
-# Enumeration type specifier
-# name: an optional ID
-# values: an EnumeratorList
-#
-Enum: [name, values*]
-
-# A name/value pair for enumeration values
-#
-Enumerator: [name, value*]
-
-# A list of enumerators
-#
-EnumeratorList: [enumerators**]
-
-# A list of expressions separated by the comma operator.
-#
-ExprList: [exprs**]
-
-# This is the top of the AST, representing a single C file (a 
-# translation unit in K&R jargon). It contains a list of 
-# "external-declaration"s, which is either declarations (Decl),
-# Typedef or function definitions (FuncDef).
-# 
-FileAST: [ext**]
-
-# for (init; cond; next) stmt
-#
-For: [init*, cond*, next*, stmt*]
-
-# name: Id
-# args: ExprList
-#
-FuncCall: [name*, args*]
-
-# type <decl>(args)
-#
-FuncDecl: [args*, type*]
-
-# Function definition: a declarator for the function name and
-# a body, which is a compound statement. 
-# There's an optional list of parameter declarations for old
-# K&R-style definitions
-#
-FuncDef: [decl*, param_decls**, body*]
-
-Goto: [name]
-
-ID: [name]
-
-# Holder for types that are a simple identifier (e.g. the built
-# ins void, char etc. and typedef-defined types)
-#
-IdentifierType: [names]
-
-If: [cond*, iftrue*, iffalse*]
-
-# An initialization list used for compound literals.
-#
-InitList: [exprs**]
-
-Label: [name, stmt*]
-
-# A named initializer for C99.
-# The name of a NamedInitializer is a sequence of Nodes, because
-# names can be hierarchical and contain constant expressions.
-#
-NamedInitializer: [name**, expr*]
-
-# a list of comma separated function parameter declarations
-#
-ParamList: [params**]
-
-PtrDecl: [quals, type*]
-
-Return: [expr*]
-
-# name: struct tag name
-# decls: declaration of members
-#
-Struct: [name, decls**]
-
-# type: . or ->
-# name.field or name->field
-#
-StructRef: [name*, type, field*]
-
-Switch: [cond*, stmt*]
-
-# cond ? iftrue : iffalse
-#
-TernaryOp: [cond*, iftrue*, iffalse*]
-
-# A base type declaration
-#
-TypeDecl: [declname, quals, type*]
-
-# A typedef declaration.
-# Very similar to Decl, but without some attributes
-#
-Typedef: [name, quals, storage, type*]
-
-Typename: [quals, type*]
-
-UnaryOp: [op, expr*]
-
-# name: union tag name
-# decls: declaration of members
-#
-Union: [name, decls**]
-
-While: [cond*, stmt*]
-
-
-
+#-----------------------------------------------------------------
+# pycparser: _c_ast.cfg
+#
+# Defines the AST Node classes used in pycparser.
+#
+# Each entry is a Node sub-class name, listing the attributes
+# and child nodes of the class:
+#   <name>*     - a child node
+#   <name>**    - a sequence of child nodes
+#   <name>      - an attribute
+#
+# Copyright (C) 2008-2015, Eli Bendersky
+# License: BSD
+#-----------------------------------------------------------------
+
+# ArrayDecl is a nested declaration of an array with the given type.
+# dim: the dimension (for example, constant 42)
+# dim_quals: list of dimension qualifiers, to support C99's allowing 'const'
+#            and 'static' within the array dimension in function declarations.
+ArrayDecl: [type*, dim*, dim_quals]
+
+ArrayRef: [name*, subscript*]
+
+# op: =, +=, /= etc.
+#
+Assignment: [op, lvalue*, rvalue*]
+
+BinaryOp: [op, left*, right*]
+
+Break: []
+
+Case: [expr*, stmts**]
+
+Cast: [to_type*, expr*]
+
+# Compound statement in C99 is a list of block items (declarations or
+# statements).
+#
+Compound: [block_items**]
+
+# Compound literal (anonymous aggregate) for C99.
+# (type-name) {initializer_list}
+# type: the typename
+# init: InitList for the initializer list
+#
+CompoundLiteral: [type*, init*]
+
+# type: int, char, float, etc. see CLexer for constant token types
+#
+Constant: [type, value]
+
+Continue: []
+
+# name: the variable being declared
+# quals: list of qualifiers (const, volatile)
+# funcspec: list function specifiers (i.e. inline in C99)
+# storage: list of storage specifiers (extern, register, etc.)
+# type: declaration type (probably nested with all the modifiers)
+# init: initialization value, or None
+# bitsize: bit field size, or None
+#
+Decl: [name, quals, storage, funcspec, type*, init*, bitsize*]
+
+DeclList: [decls**]
+
+Default: [stmts**]
+
+DoWhile: [cond*, stmt*]
+
+# Represents the ellipsis (...) parameter in a function
+# declaration
+#
+EllipsisParam: []
+
+# An empty statement (a semicolon ';' on its own)
+#
+EmptyStatement: []
+
+# Enumeration type specifier
+# name: an optional ID
+# values: an EnumeratorList
+#
+Enum: [name, values*]
+
+# A name/value pair for enumeration values
+#
+Enumerator: [name, value*]
+
+# A list of enumerators
+#
+EnumeratorList: [enumerators**]
+
+# A list of expressions separated by the comma operator.
+#
+ExprList: [exprs**]
+
+# This is the top of the AST, representing a single C file (a
+# translation unit in K&R jargon). It contains a list of
+# "external-declaration"s, which is either declarations (Decl),
+# Typedef or function definitions (FuncDef).
+#
+FileAST: [ext**]
+
+# for (init; cond; next) stmt
+#
+For: [init*, cond*, next*, stmt*]
+
+# name: Id
+# args: ExprList
+#
+FuncCall: [name*, args*]
+
+# type <decl>(args)
+#
+FuncDecl: [args*, type*]
+
+# Function definition: a declarator for the function name and
+# a body, which is a compound statement.
+# There's an optional list of parameter declarations for old
+# K&R-style definitions
+#
+FuncDef: [decl*, param_decls**, body*]
+
+Goto: [name]
+
+ID: [name]
+
+# Holder for types that are a simple identifier (e.g. the built
+# ins void, char etc. and typedef-defined types)
+#
+IdentifierType: [names]
+
+If: [cond*, iftrue*, iffalse*]
+
+# An initialization list used for compound literals.
+#
+InitList: [exprs**]
+
+Label: [name, stmt*]
+
+# A named initializer for C99.
+# The name of a NamedInitializer is a sequence of Nodes, because
+# names can be hierarchical and contain constant expressions.
+#
+NamedInitializer: [name**, expr*]
+
+# a list of comma separated function parameter declarations
+#
+ParamList: [params**]
+
+PtrDecl: [quals, type*]
+
+Return: [expr*]
+
+# name: struct tag name
+# decls: declaration of members
+#
+Struct: [name, decls**]
+
+# type: . or ->
+# name.field or name->field
+#
+StructRef: [name*, type, field*]
+
+Switch: [cond*, stmt*]
+
+# cond ? iftrue : iffalse
+#
+TernaryOp: [cond*, iftrue*, iffalse*]
+
+# A base type declaration
+#
+TypeDecl: [declname, quals, type*]
+
+# A typedef declaration.
+# Very similar to Decl, but without some attributes
+#
+Typedef: [name, quals, storage, type*]
+
+Typename: [name, quals, type*]
+
+UnaryOp: [op, expr*]
+
+# name: union tag name
+# decls: declaration of members
+#
+Union: [name, decls**]
+
+While: [cond*, stmt*]
diff --git a/lib_pypy/cffi/_pycparser/ast_transforms.py b/lib_pypy/cffi/_pycparser/ast_transforms.py
--- a/lib_pypy/cffi/_pycparser/ast_transforms.py
+++ b/lib_pypy/cffi/_pycparser/ast_transforms.py
@@ -3,7 +3,7 @@
 #
 # Some utilities used by the parser to create a friendlier AST.
 #
-# Copyright (C) 2008-2012, Eli Bendersky
+# Copyright (C) 2008-2015, Eli Bendersky
 # License: BSD
 #------------------------------------------------------------------------------
 
@@ -84,7 +84,7 @@
             _extract_nested_case(child, new_compound.block_items)
             last_case = new_compound.block_items[-1]
         else:
-            # Other statements are added as childrent to the last case, if it
+            # Other statements are added as children to the last case, if it
             # exists.
             if last_case is None:
                 new_compound.block_items.append(child)
diff --git a/lib_pypy/cffi/_pycparser/c_ast.py b/lib_pypy/cffi/_pycparser/c_ast.py
--- a/lib_pypy/cffi/_pycparser/c_ast.py
+++ b/lib_pypy/cffi/_pycparser/c_ast.py
@@ -1,7 +1,7 @@
 #-----------------------------------------------------------------
 # ** ATTENTION **
 # This code was automatically generated from the file:
-# _c_ast.cfg 
+# _c_ast.cfg
 #
 # Do not modify it directly. Modify the configuration file and
 # run the generator again.
@@ -11,7 +11,7 @@
 #
 # AST Node classes.
 #
-# Copyright (C) 2008-2012, Eli Bendersky
+# Copyright (C) 2008-2015, Eli Bendersky
 # License: BSD
 #-----------------------------------------------------------------
 
@@ -20,6 +20,7 @@
 
 
 class Node(object):
+    __slots__ = ()
     """ Abstract base class for AST nodes.
     """
     def children(self):
@@ -30,21 +31,21 @@
     def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None):
         """ Pretty print the Node and all its attributes and
             children (recursively) to a buffer.
-            
-            buf:   
+
+            buf:
                 Open IO buffer into which the Node is printed.
-            
-            offset: 
-                Initial offset (amount of leading spaces) 
-            
+
+            offset:
+                Initial offset (amount of leading spaces)
+
             attrnames:
                 True if you want to see the attribute names in
                 name=value pairs. False to only see the values.
-                
+
             nodenames:
-                True if you want to see the actual node names 
+                True if you want to see the actual node names
                 within their parents.
-            
+
             showcoord:
                 Do you want the coordinates of each Node to be
                 displayed.
@@ -79,47 +80,47 @@
 
 
 class NodeVisitor(object):
-    """ A base NodeVisitor class for visiting c_ast nodes. 
+    """ A base NodeVisitor class for visiting c_ast nodes.
         Subclass it and define your own visit_XXX methods, where
-        XXX is the class name you want to visit with these 
+        XXX is the class name you want to visit with these
         methods.
-        
+
         For example:
-        
+
         class ConstantVisitor(NodeVisitor):
             def __init__(self):
                 self.values = []
-            
+
             def visit_Constant(self, node):
                 self.values.append(node.value)
 
-        Creates a list of values of all the constant nodes 
+        Creates a list of values of all the constant nodes
         encountered below the given node. To use it:
-        
+
         cv = ConstantVisitor()
         cv.visit(node)
-        
+
         Notes:
-        
-        *   generic_visit() will be called for AST nodes for which 
-            no visit_XXX method was defined. 
-        *   The children of nodes for which a visit_XXX was 
+
+        *   generic_visit() will be called for AST nodes for which
+            no visit_XXX method was defined.
+        *   The children of nodes for which a visit_XXX was
             defined will not be visited - if you need this, call
-            generic_visit() on the node. 
+            generic_visit() on the node.
             You can use:
                 NodeVisitor.generic_visit(self, node)
         *   Modeled after Python's own AST visiting facilities
             (the ast module of Python 3.0)
     """
     def visit(self, node):
-        """ Visit a node. 
+        """ Visit a node.
         """
         method = 'visit_' + node.__class__.__name__
         visitor = getattr(self, method, self.generic_visit)
         return visitor(node)
-        
+
     def generic_visit(self, node):
-        """ Called if no explicit visitor function exists for a 
+        """ Called if no explicit visitor function exists for a
             node. Implements preorder visiting of the node.
         """
         for c_name, c in node.children():
@@ -127,9 +128,11 @@
 
 
 class ArrayDecl(Node):
-    def __init__(self, type, dim, coord=None):
+    __slots__ = ('type', 'dim', 'dim_quals', 'coord', '__weakref__')
+    def __init__(self, type, dim, dim_quals, coord=None):
         self.type = type
         self.dim = dim
+        self.dim_quals = dim_quals
         self.coord = coord
 
     def children(self):
@@ -138,9 +141,10 @@
         if self.dim is not None: nodelist.append(("dim", self.dim))
         return tuple(nodelist)
 
-    attr_names = ()
+    attr_names = ('dim_quals', )
 
 class ArrayRef(Node):
+    __slots__ = ('name', 'subscript', 'coord', '__weakref__')
     def __init__(self, name, subscript, coord=None):
         self.name = name
         self.subscript = subscript
@@ -155,6 +159,7 @@
     attr_names = ()
 
 class Assignment(Node):
+    __slots__ = ('op', 'lvalue', 'rvalue', 'coord', '__weakref__')
     def __init__(self, op, lvalue, rvalue, coord=None):
         self.op = op
         self.lvalue = lvalue
@@ -167,9 +172,10 @@
         if self.rvalue is not None: nodelist.append(("rvalue", self.rvalue))
         return tuple(nodelist)
 
-    attr_names = ('op',)
+    attr_names = ('op', )
 
 class BinaryOp(Node):
+    __slots__ = ('op', 'left', 'right', 'coord', '__weakref__')
     def __init__(self, op, left, right, coord=None):
         self.op = op
         self.left = left
@@ -182,9 +188,10 @@
         if self.right is not None: nodelist.append(("right", self.right))
         return tuple(nodelist)
 
-    attr_names = ('op',)
+    attr_names = ('op', )
 
 class Break(Node):
+    __slots__ = ('coord', '__weakref__')
     def __init__(self, coord=None):
         self.coord = coord
 
@@ -194,6 +201,7 @@
     attr_names = ()
 
 class Case(Node):
+    __slots__ = ('expr', 'stmts', 'coord', '__weakref__')
     def __init__(self, expr, stmts, coord=None):
         self.expr = expr
         self.stmts = stmts
@@ -209,6 +217,7 @@
     attr_names = ()
 
 class Cast(Node):
+    __slots__ = ('to_type', 'expr', 'coord', '__weakref__')
     def __init__(self, to_type, expr, coord=None):
         self.to_type = to_type
         self.expr = expr
@@ -223,6 +232,7 @@
     attr_names = ()
 
 class Compound(Node):
+    __slots__ = ('block_items', 'coord', '__weakref__')
     def __init__(self, block_items, coord=None):
         self.block_items = block_items
         self.coord = coord
@@ -236,6 +246,7 @@
     attr_names = ()
 
 class CompoundLiteral(Node):
+    __slots__ = ('type', 'init', 'coord', '__weakref__')
     def __init__(self, type, init, coord=None):
         self.type = type
         self.init = init
@@ -250,6 +261,7 @@
     attr_names = ()
 
 class Constant(Node):
+    __slots__ = ('type', 'value', 'coord', '__weakref__')
     def __init__(self, type, value, coord=None):
         self.type = type
         self.value = value
@@ -259,9 +271,10 @@
         nodelist = []
         return tuple(nodelist)
 
-    attr_names = ('type','value',)
+    attr_names = ('type', 'value', )
 
 class Continue(Node):
+    __slots__ = ('coord', '__weakref__')
     def __init__(self, coord=None):
         self.coord = coord
 
@@ -271,6 +284,7 @@
     attr_names = ()
 
 class Decl(Node):
+    __slots__ = ('name', 'quals', 'storage', 'funcspec', 'type', 'init', 'bitsize', 'coord', '__weakref__')
     def __init__(self, name, quals, storage, funcspec, type, init, bitsize, coord=None):
         self.name = name
         self.quals = quals
@@ -288,9 +302,10 @@
         if self.bitsize is not None: nodelist.append(("bitsize", self.bitsize))
         return tuple(nodelist)
 
-    attr_names = ('name','quals','storage','funcspec',)
+    attr_names = ('name', 'quals', 'storage', 'funcspec', )
 
 class DeclList(Node):
+    __slots__ = ('decls', 'coord', '__weakref__')
     def __init__(self, decls, coord=None):
         self.decls = decls
         self.coord = coord
@@ -304,6 +319,7 @@
     attr_names = ()
 
 class Default(Node):
+    __slots__ = ('stmts', 'coord', '__weakref__')
     def __init__(self, stmts, coord=None):
         self.stmts = stmts
         self.coord = coord
@@ -317,6 +333,7 @@
     attr_names = ()
 
 class DoWhile(Node):
+    __slots__ = ('cond', 'stmt', 'coord', '__weakref__')
     def __init__(self, cond, stmt, coord=None):
         self.cond = cond
         self.stmt = stmt
@@ -331,6 +348,7 @@
     attr_names = ()
 
 class EllipsisParam(Node):
+    __slots__ = ('coord', '__weakref__')
     def __init__(self, coord=None):
         self.coord = coord
 
@@ -340,6 +358,7 @@
     attr_names = ()
 
 class EmptyStatement(Node):
+    __slots__ = ('coord', '__weakref__')
     def __init__(self, coord=None):
         self.coord = coord
 
@@ -349,6 +368,7 @@
     attr_names = ()
 
 class Enum(Node):
+    __slots__ = ('name', 'values', 'coord', '__weakref__')
     def __init__(self, name, values, coord=None):
         self.name = name
         self.values = values
@@ -359,9 +379,10 @@
         if self.values is not None: nodelist.append(("values", self.values))
         return tuple(nodelist)
 
-    attr_names = ('name',)
+    attr_names = ('name', )
 
 class Enumerator(Node):
+    __slots__ = ('name', 'value', 'coord', '__weakref__')
     def __init__(self, name, value, coord=None):
         self.name = name
         self.value = value
@@ -372,9 +393,10 @@
         if self.value is not None: nodelist.append(("value", self.value))
         return tuple(nodelist)
 
-    attr_names = ('name',)
+    attr_names = ('name', )
 
 class EnumeratorList(Node):
+    __slots__ = ('enumerators', 'coord', '__weakref__')
     def __init__(self, enumerators, coord=None):
         self.enumerators = enumerators
         self.coord = coord
@@ -388,6 +410,7 @@
     attr_names = ()
 
 class ExprList(Node):
+    __slots__ = ('exprs', 'coord', '__weakref__')
     def __init__(self, exprs, coord=None):
         self.exprs = exprs
         self.coord = coord
@@ -401,6 +424,7 @@
     attr_names = ()
 
 class FileAST(Node):
+    __slots__ = ('ext', 'coord', '__weakref__')
     def __init__(self, ext, coord=None):
         self.ext = ext
         self.coord = coord
@@ -414,6 +438,7 @@
     attr_names = ()
 
 class For(Node):
+    __slots__ = ('init', 'cond', 'next', 'stmt', 'coord', '__weakref__')
     def __init__(self, init, cond, next, stmt, coord=None):
         self.init = init
         self.cond = cond
@@ -432,6 +457,7 @@
     attr_names = ()
 
 class FuncCall(Node):
+    __slots__ = ('name', 'args', 'coord', '__weakref__')
     def __init__(self, name, args, coord=None):
         self.name = name
         self.args = args
@@ -446,6 +472,7 @@
     attr_names = ()
 
 class FuncDecl(Node):
+    __slots__ = ('args', 'type', 'coord', '__weakref__')
     def __init__(self, args, type, coord=None):
         self.args = args
         self.type = type
@@ -460,6 +487,7 @@
     attr_names = ()
 
 class FuncDef(Node):
+    __slots__ = ('decl', 'param_decls', 'body', 'coord', '__weakref__')
     def __init__(self, decl, param_decls, body, coord=None):
         self.decl = decl
         self.param_decls = param_decls
@@ -477,6 +505,7 @@
     attr_names = ()
 
 class Goto(Node):
+    __slots__ = ('name', 'coord', '__weakref__')
     def __init__(self, name, coord=None):
         self.name = name
         self.coord = coord
@@ -485,9 +514,10 @@
         nodelist = []
         return tuple(nodelist)
 
-    attr_names = ('name',)
+    attr_names = ('name', )
 
 class ID(Node):
+    __slots__ = ('name', 'coord', '__weakref__')
     def __init__(self, name, coord=None):
         self.name = name
         self.coord = coord
@@ -496,9 +526,10 @@
         nodelist = []
         return tuple(nodelist)
 
-    attr_names = ('name',)
+    attr_names = ('name', )
 
 class IdentifierType(Node):
+    __slots__ = ('names', 'coord', '__weakref__')
     def __init__(self, names, coord=None):
         self.names = names
         self.coord = coord
@@ -507,9 +538,10 @@
         nodelist = []
         return tuple(nodelist)
 
-    attr_names = ('names',)
+    attr_names = ('names', )
 
 class If(Node):
+    __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__')
     def __init__(self, cond, iftrue, iffalse, coord=None):
         self.cond = cond
         self.iftrue = iftrue
@@ -526,6 +558,7 @@
     attr_names = ()
 
 class InitList(Node):
+    __slots__ = ('exprs', 'coord', '__weakref__')
     def __init__(self, exprs, coord=None):
         self.exprs = exprs
         self.coord = coord
@@ -539,6 +572,7 @@
     attr_names = ()
 
 class Label(Node):
+    __slots__ = ('name', 'stmt', 'coord', '__weakref__')
     def __init__(self, name, stmt, coord=None):
         self.name = name
         self.stmt = stmt
@@ -549,9 +583,10 @@
         if self.stmt is not None: nodelist.append(("stmt", self.stmt))
         return tuple(nodelist)
 
-    attr_names = ('name',)
+    attr_names = ('name', )
 
 class NamedInitializer(Node):
+    __slots__ = ('name', 'expr', 'coord', '__weakref__')
     def __init__(self, name, expr, coord=None):
         self.name = name
         self.expr = expr
@@ -567,6 +602,7 @@
     attr_names = ()
 
 class ParamList(Node):
+    __slots__ = ('params', 'coord', '__weakref__')
     def __init__(self, params, coord=None):
         self.params = params
         self.coord = coord
@@ -580,6 +616,7 @@
     attr_names = ()
 
 class PtrDecl(Node):
+    __slots__ = ('quals', 'type', 'coord', '__weakref__')
     def __init__(self, quals, type, coord=None):
         self.quals = quals
         self.type = type
@@ -590,9 +627,10 @@
         if self.type is not None: nodelist.append(("type", self.type))
         return tuple(nodelist)
 
-    attr_names = ('quals',)
+    attr_names = ('quals', )
 
 class Return(Node):
+    __slots__ = ('expr', 'coord', '__weakref__')
     def __init__(self, expr, coord=None):
         self.expr = expr
         self.coord = coord
@@ -605,6 +643,7 @@
     attr_names = ()
 
 class Struct(Node):
+    __slots__ = ('name', 'decls', 'coord', '__weakref__')
     def __init__(self, name, decls, coord=None):
         self.name = name
         self.decls = decls
@@ -616,9 +655,10 @@
             nodelist.append(("decls[%d]" % i, child))
         return tuple(nodelist)
 
-    attr_names = ('name',)
+    attr_names = ('name', )
 
 class StructRef(Node):
+    __slots__ = ('name', 'type', 'field', 'coord', '__weakref__')
     def __init__(self, name, type, field, coord=None):
         self.name = name
         self.type = type
@@ -631,9 +671,10 @@
         if self.field is not None: nodelist.append(("field", self.field))
         return tuple(nodelist)
 
-    attr_names = ('type',)
+    attr_names = ('type', )
 
 class Switch(Node):
+    __slots__ = ('cond', 'stmt', 'coord', '__weakref__')
     def __init__(self, cond, stmt, coord=None):
         self.cond = cond
         self.stmt = stmt
@@ -648,6 +689,7 @@
     attr_names = ()
 
 class TernaryOp(Node):
+    __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__')
     def __init__(self, cond, iftrue, iffalse, coord=None):
         self.cond = cond
         self.iftrue = iftrue
@@ -664,6 +706,7 @@
     attr_names = ()
 
 class TypeDecl(Node):
+    __slots__ = ('declname', 'quals', 'type', 'coord', '__weakref__')
     def __init__(self, declname, quals, type, coord=None):
         self.declname = declname
         self.quals = quals
@@ -675,9 +718,10 @@
         if self.type is not None: nodelist.append(("type", self.type))
         return tuple(nodelist)
 
-    attr_names = ('declname','quals',)
+    attr_names = ('declname', 'quals', )
 
 class Typedef(Node):
+    __slots__ = ('name', 'quals', 'storage', 'type', 'coord', '__weakref__')
     def __init__(self, name, quals, storage, type, coord=None):
         self.name = name
         self.quals = quals
@@ -690,10 +734,12 @@
         if self.type is not None: nodelist.append(("type", self.type))
         return tuple(nodelist)
 
-    attr_names = ('name','quals','storage',)
+    attr_names = ('name', 'quals', 'storage', )
 
 class Typename(Node):
-    def __init__(self, quals, type, coord=None):
+    __slots__ = ('name', 'quals', 'type', 'coord', '__weakref__')
+    def __init__(self, name, quals, type, coord=None):
+        self.name = name
         self.quals = quals
         self.type = type
         self.coord = coord
@@ -703,9 +749,10 @@
         if self.type is not None: nodelist.append(("type", self.type))
         return tuple(nodelist)
 
-    attr_names = ('quals',)
+    attr_names = ('name', 'quals', )
 
 class UnaryOp(Node):
+    __slots__ = ('op', 'expr', 'coord', '__weakref__')
     def __init__(self, op, expr, coord=None):
         self.op = op
         self.expr = expr
@@ -716,9 +763,10 @@
         if self.expr is not None: nodelist.append(("expr", self.expr))
         return tuple(nodelist)
 
-    attr_names = ('op',)
+    attr_names = ('op', )
 
 class Union(Node):
+    __slots__ = ('name', 'decls', 'coord', '__weakref__')
     def __init__(self, name, decls, coord=None):
         self.name = name
         self.decls = decls
@@ -730,9 +778,10 @@
             nodelist.append(("decls[%d]" % i, child))
         return tuple(nodelist)
 
-    attr_names = ('name',)
+    attr_names = ('name', )
 
 class While(Node):
+    __slots__ = ('cond', 'stmt', 'coord', '__weakref__')
     def __init__(self, cond, stmt, coord=None):
         self.cond = cond
         self.stmt = stmt
diff --git a/lib_pypy/cffi/_pycparser/c_generator.py b/lib_pypy/cffi/_pycparser/c_generator.py
--- a/lib_pypy/cffi/_pycparser/c_generator.py
+++ b/lib_pypy/cffi/_pycparser/c_generator.py
@@ -3,7 +3,7 @@
 #
 # C code generator from pycparser AST nodes.
 #
-# Copyright (C) 2008-2012, Eli Bendersky
+# Copyright (C) 2008-2015, Eli Bendersky
 # License: BSD
 #------------------------------------------------------------------------------
 from . import c_ast
@@ -15,8 +15,6 @@
         generic_visit.
     """
     def __init__(self):
-        self.output = ''
-
         # Statements start with indentation of self.indent_level spaces, using
         # the _make_indent method
         #
@@ -34,7 +32,7 @@
         if node is None:
             return ''
         else:
-            return ''.join(self.visit(c) for c in node.children())
+            return ''.join(self.visit(c) for c_name, c in node.children())


More information about the pypy-commit mailing list