[pypy-commit] pypy release-pypy2.7-v7.x: merge default into release

mattip pypy.commits at gmail.com
Mon Mar 11 13:42:40 EDT 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: release-pypy2.7-v7.x
Changeset: r96286:88550581f18c
Date: 2019-03-11 19:41 +0200
http://bitbucket.org/pypy/pypy/changeset/88550581f18c/

Log:	merge default into release

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -123,7 +123,9 @@
   Wenzhu Man
   Konstantin Lopuhin
   John Witulski
+  Stefan Beyer
   Jeremy Thurgood
+  Andrew Lawrence
   Greg Price
   Ivan Sichmann Freitas
   Dario Bertini
@@ -134,7 +136,6 @@
   Jean-Philippe St. Pierre
   Guido van Rossum
   Pavel Vinogradov
-  Stefan Beyer
   William Leslie
   Paweł Piotr Przeradowski
   marky1991
@@ -152,6 +153,7 @@
   Wanja Saatkamp
   Mike Blume
   Gerald Klix
+  Julian Berman
   Oscar Nierstrasz
   Rami Chowdhury
   Stefan H. Muller
@@ -174,6 +176,7 @@
   Anton Gulenko
   Sergey Matyunin
   Andrew Chambers
+  Łukasz Langa
   Nicolas Chauvat
   Andrew Durdin
   Ben Young
@@ -296,7 +299,6 @@
   Bobby Impollonia
   Roberto De Ioris
   Jeong YunWon
-  andrewjlawrence
   Christopher Armstrong
   Aaron Tubbs
   Vasantha Ganesh K
@@ -328,7 +330,6 @@
   Ben Darnell
   Juan Francisco Cantero Hurtado
   Godefroid Chappelle
-  Julian Berman
   Stephan Busemann
   Dan Colish
   timo
diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst
--- a/pypy/doc/contributor.rst
+++ b/pypy/doc/contributor.rst
@@ -90,7 +90,9 @@
   Wenzhu Man
   Konstantin Lopuhin
   John Witulski
+  Stefan Beyer
   Jeremy Thurgood
+  Andrew Lawrence
   Greg Price
   Ivan Sichmann Freitas
   Dario Bertini
@@ -101,7 +103,6 @@
   Jean-Philippe St. Pierre
   Guido van Rossum
   Pavel Vinogradov
-  Stefan Beyer
   William Leslie
   Paweł Piotr Przeradowski
   marky1991
@@ -119,6 +120,7 @@
   Wanja Saatkamp
   Mike Blume
   Gerald Klix
+  Julian Berman
   Oscar Nierstrasz
   Rami Chowdhury
   Stefan H. Muller
@@ -141,6 +143,7 @@
   Anton Gulenko
   Sergey Matyunin
   Andrew Chambers
+  Łukasz Langa
   Nicolas Chauvat
   Andrew Durdin
   Ben Young
@@ -263,7 +266,6 @@
   Bobby Impollonia
   Roberto De Ioris
   Jeong YunWon
-  andrewjlawrence
   Christopher Armstrong
   Aaron Tubbs
   Vasantha Ganesh K
@@ -295,7 +297,6 @@
   Ben Darnell
   Juan Francisco Cantero Hurtado
   Godefroid Chappelle
-  Julian Berman
   Stephan Busemann
   Dan Colish
   timo
diff --git a/pypy/doc/release-v7.1.0.rst b/pypy/doc/release-v7.1.0.rst
--- a/pypy/doc/release-v7.1.0.rst
+++ b/pypy/doc/release-v7.1.0.rst
@@ -14,6 +14,13 @@
 The interpreters are based on much the same codebase, thus the double
 release.
 
+This release, coming fast on the heels of 7.0 in February, finally merges the
+internal refactoring of unicode representation as UTF-8. Removing the
+conversions from strings to unicode internally lead to a nice speed bump.
+
+We also improved the ability to use the buffer protocol with ctype structures
+and arrays.
+
 Until we can work with downstream providers to distribute builds with PyPy, we
 have made packages for some common packages `available as wheels`_.
 
diff --git a/pypy/doc/tool/makecontributor.py b/pypy/doc/tool/makecontributor.py
--- a/pypy/doc/tool/makecontributor.py
+++ b/pypy/doc/tool/makecontributor.py
@@ -1,4 +1,5 @@
 # NOTE: run this script with LANG=en_US.UTF-8
+# works with pip install mercurial==3.0
 
 import py
 import sys
@@ -89,6 +90,7 @@
     'Laurence Tratt': ['ltratt'],
     'Pieter Zieschang': ['pzieschang', 'p_zieschang at yahoo.de'],
     'John Witulski': ['witulski'],
+    'Andrew Lawrence': ['andrew.lawrence at siemens.com', 'andrewjlawrence'],
     }
 
 alias_map = {}
diff --git a/pypy/module/_codecs/test/test_codecs.py b/pypy/module/_codecs/test/test_codecs.py
--- a/pypy/module/_codecs/test/test_codecs.py
+++ b/pypy/module/_codecs/test/test_codecs.py
@@ -457,6 +457,20 @@
         raises(TypeError, b"hello".decode, "test.mytestenc")
         raises(TypeError, u"hello".encode, "test.mytestenc")
 
+    def test_one_arg_encoder(self):
+        import _codecs
+        def search_function(encoding):
+            def encode_one(u):
+                return (b'foo', len(u))
+            def decode_one(u):
+                return (u'foo', len(u))
+            if encoding == 'onearg':
+                return (encode_one, decode_one, None, None)
+            return None
+        _codecs.register(search_function)
+        assert u"hello".encode("onearg") == 'foo'
+        assert b"hello".decode("onearg") == 'foo'
+
     def test_cpytest_decode(self):
         import codecs
         assert codecs.decode(b'\xe4\xf6\xfc', 'latin-1') == u'\xe4\xf6\xfc'
@@ -519,7 +533,7 @@
         import _codecs, array
         assert _codecs.readbuffer_encode(array.array('c', 'spam')) == ('spam', 4)
         exc = raises(TypeError, _codecs.charbuffer_encode, array.array('c', 'spam'))
-        assert str(exc.value) == "must be string or read-only character buffer, not array.array"
+        assert "must be string or read-only character buffer, not array.array" in str(exc.value)
         assert _codecs.readbuffer_encode(u"test") == ('test', 4)
         assert _codecs.charbuffer_encode(u"test") == ('test', 4)
 
diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -1073,10 +1073,6 @@
 
 def encode_object(space, w_object, encoding, errors):
     w_encoder = None
-    if encoding is None:
-        # Get the encoder functions as a wrapped object.
-        # This lookup is cached.
-        w_encoder = space.sys.get_w_default_encoder()
     if errors is None or errors == 'strict':
         if ((encoding is None and space.sys.defaultencoding == 'ascii') or
              encoding == 'ascii'):
@@ -1101,14 +1097,18 @@
             if rutf8.has_surrogates(utf8):
                 utf8 = rutf8.reencode_utf8_with_surrogates(utf8)
             return space.newbytes(utf8)
+    if encoding is None:
+        # Get the encoder functions as a wrapped object.
+        # This lookup is cached.
+        w_encoder = space.sys.get_w_default_encoder()
     if w_encoder is None:
         from pypy.module._codecs.interp_codecs import lookup_codec
         w_encoder = space.getitem(lookup_codec(space, encoding), space.newint(0))
     if errors is None:
-        w_errors = space.newtext('strict')
+        w_restuple = space.call_function(w_encoder, w_object)
     else:
         w_errors = space.newtext(errors)
-    w_restuple = space.call_function(w_encoder, w_object, w_errors)
+        w_restuple = space.call_function(w_encoder, w_object, w_errors)
     w_retval = space.getitem(w_restuple, space.newint(0))
     if not space.isinstance_w(w_retval, space.w_bytes):
         raise oefmt(space.w_TypeError,
@@ -1118,9 +1118,9 @@
 
 
 def decode_object(space, w_obj, encoding, errors):
-    if encoding is None:
-        encoding = getdefaultencoding(space)
     if errors is None or errors == 'strict':
+        if encoding is None:
+            encoding = getdefaultencoding(space)
         if encoding == 'ascii':
             s = space.charbuf_w(w_obj)
             unicodehelper.check_ascii_or_raise(space, s)
@@ -1133,14 +1133,19 @@
                 s = space.charbuf_w(w_obj)
             lgt = unicodehelper.check_utf8_or_raise(space, s)
             return space.newutf8(s, lgt)
-    w_codecs = space.getbuiltinmodule("_codecs")
-    w_decode = space.getattr(w_codecs, space.newtext("decode"))
+    w_decoder = None
+    if encoding is None:
+        # Get the decoder functions as a wrapped object.
+        # This lookup is cached.
+        w_decoder = space.sys.get_w_default_decoder()
+    if w_decoder is None:
+        from pypy.module._codecs.interp_codecs import lookup_codec
+        w_decoder = space.getitem(lookup_codec(space, encoding), space.newint(1))
     if errors is None:
-        w_retval = space.call_function(w_decode, w_obj, space.newtext(encoding))
+        w_retval = space.call_function(w_decoder, w_obj)
     else:
-        w_retval = space.call_function(w_decode, w_obj, space.newtext(encoding),
-                                       space.newtext(errors))
-    return w_retval
+        w_retval = space.call_function(w_decoder, w_obj, space.newtext(errors))
+    return space.getitem(w_retval, space.newint(0))
 
 
 def unicode_from_encoded_object(space, w_obj, encoding, errors):


More information about the pypy-commit mailing list