[pypy-commit] pypy py3.5: merge py3k

2016-09-17 Thread pjenvey
Author: Philip Jenvey 
Branch: py3.5
Changeset: r87184:d90b226fa2b8
Date: 2016-09-17 10:09 -0700
http://bitbucket.org/pypy/pypy/changeset/d90b226fa2b8/

Log:merge py3k

___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.5: merge py3k

2016-08-30 Thread plan_rich
Author: Richard Plangger 
Branch: py3.5
Changeset: r86724:b820e0d4b544
Date: 2016-08-30 10:12 +0200
http://bitbucket.org/pypy/pypy/changeset/b820e0d4b544/

Log:merge py3k

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -74,6 +74,7 @@
   Seo Sanghyeon
   Ronny Pfannschmidt
   Justin Peel
+  Raffael Tfirst
   David Edelsohn
   Anders Hammarquist
   Jakub Gustak
@@ -117,7 +118,6 @@
   Wenzhu Man
   John Witulski
   Laurence Tratt
-  Raffael Tfirst
   Ivan Sichmann Freitas
   Greg Price
   Dario Bertini
@@ -141,6 +141,7 @@
   tav
   Taavi Burns
   Georg Brandl
+  Nicolas Truessel
   Bert Freudenberg
   Stian Andreassen
   Wanja Saatkamp
@@ -211,6 +212,7 @@
   Vaibhav Sood
   Alan McIntyre
   Alexander Sedov
+  p_ziesch...@yahoo.de
   Attila Gobi
   Jasper.Schulz
   Christopher Pope
@@ -221,6 +223,7 @@
   Arjun Naik
   Valentina Mukhamedzhanova
   Stefano Parmesan
+  touilleMan
   Alexis Daboville
   Jens-Uwe Mager
   Carl Meyer
@@ -229,12 +232,14 @@
   Gabriel
   Lukas Vacek
   Kunal Grover
+  Aaron Gallagher
   Andrew Dalke
   Sylvain Thenault
   Jakub Stasiak
   Nathan Taylor
   Vladimir Kryachko
   Omer Katz
+  Mark Williams
   Jacek Generowicz
   Alejandro J. Cura
   Jacob Oscarson
@@ -355,12 +360,15 @@
   yasirs
   Michael Chermside
   Anna Ravencroft
+  pizi
   Andrey Churin
   Dan Crosta
+  Eli Stevens
   Tobias Diaz
   Julien Phalip
   Roman Podoliaka
   Dan Loewenherz
+  werat
 
   Heinrich-Heine University, Germany 
   Open End AB (formerly AB Strakt), Sweden
@@ -468,15 +476,3 @@
 
 https://github.com/gperftools/gperftools/blob/master/COPYING
 
-License for 'liblzma and 'lzmaffi'
---
-
-This copy of PyPy may be linked (dynamically or statically) with the
-liblzma library, which was put in the "public domain":
-
-http://tukaani.org/xz/
-
-The cffi bindings to liblzma (in lib_pypy/_lzma.py) are derived from
-the lzmaffi project which is distributed under a BSD license:
-
-https://pypi.python.org/pypi/lzmaffi/0.3.0
diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst
--- a/pypy/doc/contributor.rst
+++ b/pypy/doc/contributor.rst
@@ -44,6 +44,7 @@
   Seo Sanghyeon
   Ronny Pfannschmidt
   Justin Peel
+  Raffael Tfirst
   David Edelsohn
   Anders Hammarquist
   Jakub Gustak
@@ -87,7 +88,6 @@
   Wenzhu Man
   John Witulski
   Laurence Tratt
-  Raffael Tfirst
   Ivan Sichmann Freitas
   Greg Price
   Dario Bertini
@@ -111,6 +111,7 @@
   tav
   Taavi Burns
   Georg Brandl
+  Nicolas Truessel
   Bert Freudenberg
   Stian Andreassen
   Wanja Saatkamp
@@ -181,6 +182,7 @@
   Vaibhav Sood
   Alan McIntyre
   Alexander Sedov
+  p_ziesch...@yahoo.de
   Attila Gobi
   Jasper.Schulz
   Christopher Pope
@@ -191,6 +193,7 @@
   Arjun Naik
   Valentina Mukhamedzhanova
   Stefano Parmesan
+  touilleMan
   Alexis Daboville
   Jens-Uwe Mager
   Carl Meyer
@@ -199,12 +202,14 @@
   Gabriel
   Lukas Vacek
   Kunal Grover
+  Aaron Gallagher
   Andrew Dalke
   Sylvain Thenault
   Jakub Stasiak
   Nathan Taylor
   Vladimir Kryachko
   Omer Katz
+  Mark Williams
   Jacek Generowicz
   Alejandro J. Cura
   Jacob Oscarson
@@ -325,9 +330,12 @@
   yasirs
   Michael Chermside
   Anna Ravencroft
+  pizi
   Andrey Churin
   Dan Crosta
+  Eli Stevens
   Tobias Diaz
   Julien Phalip
   Roman Podoliaka
   Dan Loewenherz
+  werat
diff --git a/pypy/doc/release-pypy2.7-v5.4.0.rst 
b/pypy/doc/release-pypy2.7-v5.4.0.rst
--- a/pypy/doc/release-pypy2.7-v5.4.0.rst
+++ b/pypy/doc/release-pypy2.7-v5.4.0.rst
@@ -3,7 +3,8 @@
 
 
 We have released PyPy2.7 v5.4, a little under two months after PyPy2.7 v5.3.
-This new PyPy2.7 release includes further improvements to our C-API 
compatability layer (cpyext), enabling us to pass over 99% of the upstream
+This new PyPy2.7 release includes incremental improvements to our C-API
+compatability layer (cpyext), enabling us to pass over 99% of the upstream
 numpy `test suite`_. We updated built-in cffi_ support to version 1.8,
 which now supports the "limited API" mode for c-extensions on 
 CPython >=3.2.
@@ -12,9 +13,7 @@
 support to OpenBSD and Dragon Fly BSD
 
 As always, this release fixed many issues and bugs raised by the
-growing community of PyPy users. 
-
-X MORE ???
+growing community of PyPy users. We strongly recommend updating.
 
 You can download the PyPy2.7 v5.4 release here:
 
@@ -110,8 +109,8 @@
 
   * (RPython) add `rposix_scandir` portably, needed for Python 3.5
 
-  * Support for memoryview attributes (format, itemsize, ...) which also
-adds support for `PyMemoryView_FromObject`
+  * Increased but incomplete support for memoryview attributes (format, 
+itemsize, ...) which also adds support for `PyMemoryView_FromObject`
 
 * Bug Fixes
 
@@ -153,10 +152,6 @@
   * Make `hash(-1)` return -2, as CPython does, and fix all the
 ancilary places this matters
 
-  * Issues reported with our previous release were resolved_ after
-reports from users on our issue tracker at
-

[pypy-commit] pypy py3.5: merge py3k

2016-08-25 Thread plan_rich
Author: Richard Plangger 
Branch: py3.5
Changeset: r86520:d13f538365f5
Date: 2016-08-25 09:33 +0200
http://bitbucket.org/pypy/pypy/changeset/d13f538365f5/

Log:merge py3k

diff --git a/pypy/module/cpyext/buffer.py b/pypy/module/cpyext/buffer.py
--- a/pypy/module/cpyext/buffer.py
+++ b/pypy/module/cpyext/buffer.py
@@ -3,35 +3,10 @@
 from rpython.rlib import buffer
 from pypy.module.cpyext.api import (
 cpython_api, CANNOT_FAIL, Py_buffer)
-from pypy.module.cpyext.pyobject import PyObject
+from pypy.module.cpyext.pyobject import PyObject, Py_DecRef
 
-@cpython_api([PyObject], rffi.INT_real, error=CANNOT_FAIL)
-def PyObject_CheckBuffer(space, w_obj):
-"""Return 1 if obj supports the buffer interface otherwise 0."""
-return 0  # the bf_getbuffer field is never filled by cpyext
-
-@cpython_api([PyObject, lltype.Ptr(Py_buffer), rffi.INT_real],
- rffi.INT_real, error=-1)
-def PyObject_GetBuffer(space, w_obj, view, flags):
-"""Export obj into a Py_buffer, view.  These arguments must
-never be NULL.  The flags argument is a bit field indicating what
-kind of buffer the caller is prepared to deal with and therefore what
-kind of buffer the exporter is allowed to return.  The buffer interface
-allows for complicated memory sharing possibilities, but some caller may
-not be able to handle all the complexity but may want to see if the
-exporter will let them take a simpler view to its memory.
-
-Some exporters may not be able to share memory in every possible way and
-may need to raise errors to signal to some consumers that something is
-just not possible. These errors should be a BufferError unless
-there is another error that is actually causing the problem. The
-exporter can use flags information to simplify how much of the
-Py_buffer structure is filled in with non-default values and/or
-raise an error if the object can't support a simpler view of its memory.
-
-0 is returned on success and -1 on error."""
-raise oefmt(space.w_TypeError,
-"PyPy does not yet implement the new buffer interface")
+# PyObject_GetBuffer has been removed, it is defined in abstract.c
+# PyObject_CheckBuffer is also already defined
 
 @cpython_api([lltype.Ptr(Py_buffer), lltype.Char], rffi.INT_real, 
error=CANNOT_FAIL)
 def PyBuffer_IsContiguous(space, view, fortran):
diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py
--- a/pypy/module/cpyext/slotdefs.py
+++ b/pypy/module/cpyext/slotdefs.py
@@ -20,6 +20,7 @@
 from rpython.rlib.buffer import Buffer
 from rpython.rlib.unroll import unrolling_iterable
 from rpython.rlib.objectmodel import specialize
+from rpython.rlib.rarithmetic import widen
 from rpython.tool.sourcetools import func_renamer
 from rpython.rtyper.annlowlevel import llhelper
 from pypy.module.sys.version import CPYTHON_VERSION
diff --git a/pypy/module/sys/__init__.py b/pypy/module/sys/__init__.py
--- a/pypy/module/sys/__init__.py
+++ b/pypy/module/sys/__init__.py
@@ -144,7 +144,7 @@
 # XXX the two lines above take a few seconds to run whenever
 # we initialize the space; for tests, use a simpler version
 from pypy.module.sys.interp_encoding import base_encoding
-self.filesystemencoding = space.wrap(base_encoding)
+self.filesystemencoding = base_encoding
 
 def flush_std_files(self, space):
 w_stdout = space.sys.getdictvalue(space, 'stdout')
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.5: merge py3k

2016-08-24 Thread plan_rich
Author: Richard Plangger 
Branch: py3.5
Changeset: r86475:a43d6aa79232
Date: 2016-08-24 11:59 +0200
http://bitbucket.org/pypy/pypy/changeset/a43d6aa79232/

Log:merge py3k

diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py
--- a/pypy/module/cpyext/slotdefs.py
+++ b/pypy/module/cpyext/slotdefs.py
@@ -11,7 +11,7 @@
 getattrfunc, getattrofunc, setattrofunc, lenfunc, ssizeargfunc, inquiry,
 ssizessizeargfunc, ssizeobjargproc, iternextfunc, initproc, richcmpfunc,
 cmpfunc, hashfunc, descrgetfunc, descrsetfunc, objobjproc, objobjargproc,
-getbufferproc, readbufferproc, ssizessizeobjargproc)
+getbufferproc, ssizessizeobjargproc)
 from pypy.module.cpyext.pyobject import from_ref, make_ref, Py_DecRef
 from pypy.module.cpyext.pyerrors import PyErr_Occurred
 from pypy.module.cpyext.state import State
@@ -22,6 +22,9 @@
 from rpython.rlib.objectmodel import specialize
 from rpython.tool.sourcetools import func_renamer
 from rpython.rtyper.annlowlevel import llhelper
+from pypy.module.sys.version import CPYTHON_VERSION
+
+PY3 = CPYTHON_VERSION[0] == 3
 
 # XXX: Also defined in object.h
 Py_LT = 0
diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py
--- a/pypy/module/cpyext/typeobject.py
+++ b/pypy/module/cpyext/typeobject.py
@@ -14,7 +14,7 @@
 from pypy.module.cpyext import structmemberdefs
 from pypy.module.cpyext.api import (
 cpython_api, cpython_struct, bootstrap_function, Py_ssize_t, Py_ssize_tP,
-generic_cpy_call, Py_TPFLAGS_READY, Py_TPFLAGS_READYING,
+generic_cpy_call, Py_TPFLAGS_READY, Py_TPFLAGS_READYING, Py_buffer,
 Py_TPFLAGS_HEAPTYPE, METH_VARARGS, METH_KEYWORDS, CANNOT_FAIL,
 Py_TPFLAGS_HAVE_GETCHARBUFFER, build_type_checkers, StaticObjectBuilder,
 PyObjectFields, Py_TPFLAGS_BASETYPE, PyTypeObject, PyTypeObjectPtr,
diff --git a/pypy/module/cpyext/typeobjectdefs.py 
b/pypy/module/cpyext/typeobjectdefs.py
--- a/pypy/module/cpyext/typeobjectdefs.py
+++ b/pypy/module/cpyext/typeobjectdefs.py
@@ -1,7 +1,7 @@
 from rpython.rtyper.lltypesystem import rffi, lltype
 from rpython.rtyper.lltypesystem.lltype import Ptr, FuncType, Void
 from pypy.module.cpyext.api import (cpython_struct, Py_ssize_t, Py_ssize_tP,
-PyVarObjectFields, PyTypeObject, PyTypeObjectPtr, FILEP, Py_Buffer,
+PyVarObjectFields, PyTypeObject, PyTypeObjectPtr, FILEP, Py_buffer,
 Py_TPFLAGS_READYING, Py_TPFLAGS_READY, Py_TPFLAGS_HEAPTYPE)
 from pypy.module.cpyext.pyobject import PyObject, make_ref, from_ref
 from pypy.module.cpyext.modsupport import PyMethodDef
@@ -54,10 +54,6 @@
 wrapperfunc = P(FT([PyO, PyO, rffi.VOIDP], PyO))
 wrapperfunc_kwds = P(FT([PyO, PyO, rffi.VOIDP, PyO], PyO))
 
-readbufferproc = P(FT([PyO, Py_ssize_t, rffi.VOIDPP], Py_ssize_t))
-writebufferproc = P(FT([PyO, Py_ssize_t, rffi.VOIDPP], Py_ssize_t))
-segcountproc = P(FT([PyO, Py_ssize_tP], Py_ssize_t))
-charbufferproc = P(FT([PyO, Py_ssize_t, rffi.CCHARPP], Py_ssize_t))
 getbufferproc = P(FT([PyO, Py_bufferP, rffi.INT_real], rffi.INT_real))
 releasebufferproc = P(FT([PyO, Py_bufferP], Void))
 
@@ -131,10 +127,6 @@
 ))
 
 PyBufferProcs = cpython_struct("PyBufferProcs", (
-("bf_getreadbuffer", readbufferproc),
-("bf_getwritebuffer", writebufferproc),
-("bf_getsegcount", segcountproc),
-("bf_getcharbuffer", charbufferproc),
 ("bf_getbuffer", getbufferproc),
 ("bf_releasebuffer", releasebufferproc),
 ))
diff --git a/pypy/objspace/std/bytesobject.py b/pypy/objspace/std/bytesobject.py
--- a/pypy/objspace/std/bytesobject.py
+++ b/pypy/objspace/std/bytesobject.py
@@ -394,13 +394,6 @@
 of the specified width. The string S is never truncated.
 """
 
-def descr_hex(self, space):
-"""S.hex() -> string
-
-Creates a hexadecimal string of the bytes object
-"""
-
-
 class W_BytesObject(W_AbstractBytesObject):
 import_from_mixin(StringMethods)
 _immutable_fields_ = ['_value']
diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -223,7 +223,7 @@
 pass
 
 if _WIN32:
-includes = ['io.h', 'sys/utime.h', 'sys/types.h', 'process.h']
+includes = ['io.h', 'sys/utime.h', 'sys/types.h', 'process.h', 'time.h']
 libraries = []
 else:
 if sys.platform.startswith(('darwin', 'netbsd', 'openbsd')):
@@ -254,10 +254,10 @@
 UTIMBUF = rffi_platform.Struct('struct %sutimbuf' % UNDERSCORE_ON_WIN32,
[('actime', rffi.INT),
 ('modtime', rffi.INT)])
+CLOCK_T = rffi_platform.SimpleType('clock_t', rffi.INT)
 if not _WIN32:
 UID_T = rffi_platform.SimpleType('uid_t', rffi.UINT)
 GID_T = rffi_platform.SimpleType('gid_t', rffi.UINT)
-CLOCK_T = rffi_platform.SimpleType('clock_t', rffi.INT)
 
 TMS = rffi_platform.Struct(
 'struct tms', [('tms_utime', rffi.INT),

[pypy-commit] pypy py3.5: merge py3k

2016-08-24 Thread plan_rich
Author: Richard Plangger 
Branch: py3.5
Changeset: r86460:304a36465049
Date: 2016-08-24 10:29 +0200
http://bitbucket.org/pypy/pypy/changeset/304a36465049/

Log:merge py3k

diff --git a/lib_pypy/_ctypes/basics.py b/lib_pypy/_ctypes/basics.py
--- a/lib_pypy/_ctypes/basics.py
+++ b/lib_pypy/_ctypes/basics.py
@@ -166,8 +166,8 @@
 else:
 return self.value
 
-def __buffer__(self):
-return memoryview(self._buffer)
+def __buffer__(self, flags):
+return buffer(self._buffer)
 
 def _get_b_base(self):
 try:
@@ -208,7 +208,7 @@
 
 def cdata_from_address(self, address):
 # fix the address: turn it into as unsigned, in case it's a negative number
-address = address & (sys.maxsize * 2 + 1)
+address = address & (sys.maxint * 2 + 1)
 instance = self.__new__(self)
 lgt = getattr(self, '_length_', 1)
 instance._buffer = self._ffiarray.fromaddress(address, lgt)
diff --git a/lib_pypy/cffi/recompiler.py b/lib_pypy/cffi/recompiler.py
--- a/lib_pypy/cffi/recompiler.py
+++ b/lib_pypy/cffi/recompiler.py
@@ -515,7 +515,7 @@
 tovar, errcode)
 return
 #
-elif isinstance(tp, (model.StructOrUnion, model.EnumType)):
+elif isinstance(tp, model.StructOrUnionOrEnum):
 # a struct (not a struct pointer) as a function argument
 self._prnt('  if (_cffi_to_c((char *)&%s, _cffi_type(%d), %s) < 0)'
   % (tovar, self._gettypenum(tp), fromvar))
@@ -572,7 +572,7 @@
 elif isinstance(tp, model.ArrayType):
 return '_cffi_from_c_pointer((char *)%s, _cffi_type(%d))' % (
 var, self._gettypenum(model.PointerType(tp.item)))
-elif isinstance(tp, model.StructType):
+elif isinstance(tp, model.StructOrUnion):
 if tp.fldnames is None:
 raise TypeError("'%s' is used as %s, but is opaque" % (
 tp._get_c_name(), context))
diff --git a/lib_pypy/cffi/vengine_cpy.py b/lib_pypy/cffi/vengine_cpy.py
--- a/lib_pypy/cffi/vengine_cpy.py
+++ b/lib_pypy/cffi/vengine_cpy.py
@@ -308,7 +308,7 @@
 elif isinstance(tp, model.ArrayType):
 return '_cffi_from_c_pointer((char *)%s, _cffi_type(%d))' % (
 var, self._gettypenum(model.PointerType(tp.item)))
-elif isinstance(tp, model.StructType):
+elif isinstance(tp, model.StructOrUnion):
 if tp.fldnames is None:
 raise TypeError("'%s' is used as %s, but is opaque" % (
 tp._get_c_name(), context))
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -144,3 +144,14 @@
 ``type.__dict__`` now returns a ``dict_proxy`` object, like on CPython.
 Previously it returned what looked like a regular dict object (but it
 was already read-only).
+
+
+.. branch: const-fold-we-are-jitted
+
+Reduce the size of the generated C code by constant-folding ``we_are_jitted``
+in non-jitcode.
+
+.. branch: memoryview-attributes
+
+Support for memoryview attributes (format, itemsize, ...).
+Extends the cpyext emulation layer.
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -585,6 +585,11 @@
 self.sys = Module(self, w_name)
 self.sys.install()
 
+from pypy.module.imp import Module
+w_name = self.wrap('imp')
+mod = Module(self, w_name)
+mod.install()
+
 from pypy.module.__builtin__ import Module
 w_name = self.wrap('builtins')
 self.builtin = Module(self, w_name)
@@ -1996,7 +2001,7 @@
 
 ObjSpace.IrregularOpTable = [
 'wrap',
-'bytes_w',
+'str_w',
 'int_w',
 'float_w',
 'uint_w',
diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py 
b/pypy/module/_cffi_backend/test/test_recompiler.py
--- a/pypy/module/_cffi_backend/test/test_recompiler.py
+++ b/pypy/module/_cffi_backend/test/test_recompiler.py
@@ -79,7 +79,7 @@
 
 
 class AppTestRecompiler:
-spaceconfig = dict(usemodules=['_cffi_backend', 'imp', 'cpyext', 'struct'])
+spaceconfig = dict(usemodules=['_cffi_backend', 'imp'])
 
 def setup_class(cls):
 if cls.runappdirect:
diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -120,7 +120,7 @@
 Py_TPFLAGS_READY Py_TPFLAGS_READYING Py_TPFLAGS_HAVE_GETCHARBUFFER
 METH_COEXIST METH_STATIC METH_CLASS Py_TPFLAGS_BASETYPE
 METH_NOARGS METH_VARARGS METH_KEYWORDS METH_O
-Py_TPFLAGS_HEAPTYPE Py_TPFLAGS_HAVE_CLASS
+Py_TPFLAGS_HEAPTYPE Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_HAVE_NEWBUFFER
 Py_LT Py_LE Py_EQ Py_NE Py_GT Py_GE Py_TPFLAGS_CHECKTYPES
 Py_CLEANUP_SUPPORTED
 """.split()
@@ -651,6 +651,7 @@
 #('smalltable', rffi.CFixedArray(Py_ssize_t, 2)),
 

[pypy-commit] pypy py3.5: merge py3k

2016-05-01 Thread pjenvey
Author: Philip Jenvey 
Branch: py3.5
Changeset: r84115:ecd0020a0f93
Date: 2016-05-01 21:44 -0700
http://bitbucket.org/pypy/pypy/changeset/ecd0020a0f93/

Log:merge py3k

diff too long, truncating to 2000 out of 20403 lines

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -20,3 +20,5 @@
 5f8302b8bf9f53056e40426f10c72151564e5b19 release-4.0.1
 246c9cf22037b11dc0e8c29ce3f291d3b8c5935a release-5.0
 bbd45126bc691f669c4ebdfbd74456cd274c6b92 release-5.0.1
+3260adbeba4a8b6659d1cc0d0b41f266769b74da release-5.1
+b0a649e90b6642251fb4a765fe5b27a97b1319a9 release-5.1.1
diff --git a/TODO b/TODO
new file mode 100644
--- /dev/null
+++ b/TODO
@@ -0,0 +1,2 @@
+* reduce size of generated c code from slot definitions in slotdefs.
+* remove broken DEBUG_REFCOUNT from pyobject.py
diff --git a/lib-python/2.7/distutils/cmd.py b/lib-python/2.7/distutils/cmd.py
--- a/lib-python/2.7/distutils/cmd.py
+++ b/lib-python/2.7/distutils/cmd.py
@@ -298,8 +298,16 @@
 src_cmd_obj.ensure_finalized()
 for (src_option, dst_option) in option_pairs:
 if getattr(self, dst_option) is None:
-setattr(self, dst_option,
-getattr(src_cmd_obj, src_option))
+try:
+setattr(self, dst_option,
+getattr(src_cmd_obj, src_option))
+except AttributeError:
+# This was added after problems with setuptools 18.4.
+# It seems that setuptools 20.9 fixes the problem.
+# But e.g. on Ubuntu 14.04 with /usr/bin/virtualenv
+# if I say "virtualenv -p pypy venv-pypy" then it
+# just installs setuptools 18.4 from some cache...
+pass
 
 
 def get_finalized_command(self, command, create=1):
diff --git a/lib-python/3/test/test_itertools.py 
b/lib-python/3/test/test_itertools.py
--- a/lib-python/3/test/test_itertools.py
+++ b/lib-python/3/test/test_itertools.py
@@ -1281,6 +1281,7 @@
 p = weakref.proxy(a)
 self.assertEqual(getattr(p, '__class__'), type(b))
 del a
+support.gc_collect()
 self.assertRaises(ReferenceError, getattr, p, '__class__')
 
 ans = list('abc')
diff --git a/lib-python/stdlib-upgrade.txt b/lib-python/stdlib-upgrade.txt
--- a/lib-python/stdlib-upgrade.txt
+++ b/lib-python/stdlib-upgrade.txt
@@ -5,15 +5,23 @@
 
 overly detailed
 
-1. check out the branch vendor/stdlib
+0. make sure your working dir is clean
+1. check out the branch vendor/stdlib (for 2.7) or vendor/stdlib-3-* (for py3k)
+   or create branch vendor/stdlib-3-*
 2. upgrade the files there
+   2a. remove lib-python/2.7/ or lib-python/3/
+   2b. copy the files from the cpython repo
+   2c. hg add lib-python/2.7/ or lib-python/3/
+   2d. hg remove --after
+   2e. show copied files in cpython repo by running `hg diff --git -r v 
-r v Lib | grep '^copy \(from\|to\)'`
+   2f. fix copies / renames manually by running `hg copy --after  ` 
for each copied file
 3. update stdlib-version.txt with the output of hg -id from the cpython repo
 4. commit
-5. update to default/py3k
+5. update to default / py3k
 6. create a integration branch for the new stdlib
(just hg branch stdlib-$version)
-7. merge vendor/stdlib
+7. merge vendor/stdlib or vendor/stdlib-3-*
 8. commit
 10. fix issues
 11. commit --close-branch
-12. merge to default
+12. merge to default / py3k
diff --git a/lib_pypy/_collections.py b/lib_pypy/_collections.py
--- a/lib_pypy/_collections.py
+++ b/lib_pypy/_collections.py
@@ -320,8 +320,7 @@
 def __reduce_ex__(self, proto):
 return type(self), (list(self), self.maxlen)
 
-def __hash__(self):
-raise TypeError("deque objects are unhashable")
+__hash__ = None
 
 def __copy__(self):
 return self.__class__(self, self.maxlen)
diff --git a/lib_pypy/_pypy_wait.py b/lib_pypy/_pypy_wait.py
--- a/lib_pypy/_pypy_wait.py
+++ b/lib_pypy/_pypy_wait.py
@@ -1,51 +1,22 @@
-from resource import _struct_rusage, struct_rusage
-from ctypes import CDLL, c_int, POINTER, byref
-from ctypes.util import find_library
+from resource import ffi, lib, _make_struct_rusage
 
 __all__ = ["wait3", "wait4"]
 
-libc = CDLL(find_library("c"))
-c_wait3 = libc.wait3
-c_wait3.argtypes = [POINTER(c_int), c_int, POINTER(_struct_rusage)]
-c_wait3.restype = c_int
-
-c_wait4 = libc.wait4
-c_wait4.argtypes = [c_int, POINTER(c_int), c_int, POINTER(_struct_rusage)]
-c_wait4.restype = c_int
-
-def create_struct_rusage(c_struct):
-return struct_rusage((
-float(c_struct.ru_utime),
-float(c_struct.ru_stime),
-c_struct.ru_maxrss,
-c_struct.ru_ixrss,
-c_struct.ru_idrss,
-c_struct.ru_isrss,
-c_struct.ru_minflt,
-c_struct.ru_majflt,
-c_struct.ru_nswap,
-c_struct.ru_inblock,
-c_struct.ru_oublock,
-c_struct.ru_msgsnd,
-c_struct.ru_msgrcv,
-