Author: Matti Picus <matti.pi...@gmail.com> Branch: release-pypy3.6-v7.x Changeset: r96285:5e9a4737b5a7 Date: 2019-03-11 19:41 +0200 http://bitbucket.org/pypy/pypy/changeset/5e9a4737b5a7/
Log: merge py3.6 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_ziesch...@yahoo.de'], 'John Witulski': ['witulski'], + 'Andrew Lawrence': ['andrew.lawre...@siemens.com', 'andrewjlawrence'], } alias_map = {} diff --git a/pypy/interpreter/unicodehelper.py b/pypy/interpreter/unicodehelper.py --- a/pypy/interpreter/unicodehelper.py +++ b/pypy/interpreter/unicodehelper.py @@ -362,6 +362,8 @@ valid so we're trying to either raise or pack stuff with error handler. The key difference is that this is call_may_force """ + if errors is None: + errors = 'strict' slen = len(s) res = StringBuilder(slen) pos = 0 diff --git a/pypy/module/_codecs/interp_codecs.py b/pypy/module/_codecs/interp_codecs.py --- a/pypy/module/_codecs/interp_codecs.py +++ b/pypy/module/_codecs/interp_codecs.py @@ -526,7 +526,10 @@ def _call_codec(space, w_coder, w_obj, action, encoding, errors): try: - w_res = space.call_function(w_coder, w_obj, space.newtext(errors)) + if errors: + w_res = space.call_function(w_coder, w_obj, space.newtext(errors)) + else: + w_res = space.call_function(w_coder, w_obj) except OperationError as operr: raise _wrap_codec_error(space, operr, action, encoding) if (not space.isinstance_w(w_res, space.w_tuple) or space.len_w(w_res) != 2): @@ -634,15 +637,11 @@ return codec_info def encode_text(space, w_obj, encoding, errors): - if errors is None: - errors = 'strict' w_encoder = space.getitem( lookup_text_codec(space, "codecs.encode()", encoding), space.newint(0)) return _call_codec(space, w_encoder, w_obj, "encoding", encoding, errors) def decode_text(space, w_obj, encoding, errors): - if errors is None: - errors = 'strict' w_decoder = space.getitem( lookup_text_codec(space, "codecs.decode()", encoding), space.newint(1)) return _call_codec(space, w_decoder, w_obj, "decoding", encoding, errors) 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 @@ -696,6 +696,20 @@ exc = raises(RuntimeError, u"hello".encode, "test.failingenc") assert exc.value == to_raise + 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") == b'foo' + assert b"hello".decode("onearg") == 'foo' + def test_cpytest_decode(self): import codecs assert codecs.decode(b'\xe4\xf6\xfc', 'latin-1') == '\xe4\xf6\xfc' diff --git a/pypy/objspace/std/stringmethods.py b/pypy/objspace/std/stringmethods.py --- a/pypy/objspace/std/stringmethods.py +++ b/pypy/objspace/std/stringmethods.py @@ -193,8 +193,6 @@ from pypy.objspace.std.unicodeobject import ( get_encoding_and_errors, decode_object) encoding, errors = get_encoding_and_errors(space, w_encoding, w_errors) - if errors is None: - errors = 'strict' if encoding is None: encoding = 'utf8' if encoding == 'utf8' or encoding == 'utf-8': 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 @@ -1209,7 +1209,7 @@ def encode_object(space, w_object, encoding, errors): - from pypy.module._codecs.interp_codecs import encode_text, CodecState + from pypy.module._codecs.interp_codecs import encode_text if errors is None or errors == 'strict': utf8 = space.utf8_w(w_object) if encoding is None or encoding == 'utf-8': @@ -1242,10 +1242,9 @@ return w_retval -def decode_object(space, w_obj, encoding, errors='strict'): - assert errors is not None +def decode_object(space, w_obj, encoding, errors=None): assert encoding is not None - if errors == 'strict': + if errors == 'strict' or errors is None: if encoding == 'ascii': s = space.charbuf_w(w_obj) unicodehelper.check_ascii_or_raise(space, s) @@ -1266,8 +1265,6 @@ def unicode_from_encoded_object(space, w_obj, encoding, errors): - if errors is None: - errors = 'strict' if encoding is None: encoding = getdefaultencoding(space) w_retval = decode_object(space, w_obj, encoding, errors) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit