Author: Armin Rigo <ar...@tunes.org> Branch: py3k Changeset: r86331:47258bd66b35 Date: 2016-08-19 20:34 +0200 http://bitbucket.org/pypy/pypy/changeset/47258bd66b35/
Log: merge heads diff --git a/lib-python/3/test/test_compileall.py b/lib-python/3/test/test_compileall.py --- a/lib-python/3/test/test_compileall.py +++ b/lib-python/3/test/test_compileall.py @@ -202,11 +202,10 @@ # Ensure that the default behavior of compileall's CLI is to create # PEP 3147 pyc/pyo files. - _pyo = 'pyo' if support.check_impl_detail() else 'pyc' for name, ext, switch in [ ('normal', 'pyc', []), - ('optimize', _pyo, ['-O']), - ('doubleoptimize', _pyo, ['-OO']), + ('optimize', 'pyo', ['-O']), + ('doubleoptimize', 'pyo', ['-OO']), ]: def f(self, ext=ext, switch=switch): script_helper.assert_python_ok(*(switch + diff --git a/pypy/module/_pypyjson/interp_decoder.py b/pypy/module/_pypyjson/interp_decoder.py --- a/pypy/module/_pypyjson/interp_decoder.py +++ b/pypy/module/_pypyjson/interp_decoder.py @@ -327,7 +327,8 @@ i += 1 if ch == '"': content_utf8 = builder.build() - content_unicode = unicodehelper.decode_utf8(self.space, content_utf8) + content_unicode = unicodehelper.decode_utf8( + self.space, content_utf8, allow_surrogates=True) self.last_type = TYPE_STRING self.pos = i return self.space.wrap(content_unicode) @@ -374,7 +375,8 @@ # this point # uchr = runicode.code_to_unichr(val) # may be a surrogate pair again - utf8_ch = unicodehelper.encode_utf8(self.space, uchr) + utf8_ch = unicodehelper.encode_utf8( + self.space, uchr, allow_surrogates=True) builder.append(utf8_ch) return i diff --git a/pypy/module/_pypyjson/test/test__pypyjson.py b/pypy/module/_pypyjson/test/test__pypyjson.py --- a/pypy/module/_pypyjson/test/test__pypyjson.py +++ b/pypy/module/_pypyjson/test/test__pypyjson.py @@ -10,10 +10,10 @@ assert dec.skip_whitespace(8) == len(s) dec.close() - + class AppTest(object): - spaceconfig = {"objspace.usemodules._pypyjson": True} + spaceconfig = {"usemodules": ['_pypyjson']} def test_raise_on_bytes(self): import _pypyjson @@ -40,7 +40,7 @@ raises(ValueError, _pypyjson.loads, 'fa') raises(ValueError, _pypyjson.loads, 'f') raises(ValueError, _pypyjson.loads, 'falXX') - + def test_decode_string(self): import _pypyjson @@ -69,7 +69,7 @@ import _pypyjson assert _pypyjson.loads(r'"\\"') == '\\' assert _pypyjson.loads(r'"\""') == '"' - assert _pypyjson.loads(r'"\/"') == '/' + assert _pypyjson.loads(r'"\/"') == '/' assert _pypyjson.loads(r'"\b"') == '\b' assert _pypyjson.loads(r'"\f"') == '\f' assert _pypyjson.loads(r'"\n"') == '\n' @@ -85,7 +85,7 @@ import _pypyjson s = r'"hello\nworld' # missing the trailing " raises(ValueError, "_pypyjson.loads(s)") - + def test_escape_sequence_unicode(self): import _pypyjson s = r'"\u1234"' @@ -166,7 +166,7 @@ def test_decode_object_nonstring_key(self): import _pypyjson raises(ValueError, "_pypyjson.loads('{42: 43}')") - + def test_decode_array(self): import _pypyjson assert _pypyjson.loads('[]') == [] @@ -183,7 +183,7 @@ res = _pypyjson.loads('"z\\ud834\\udd20x"') assert res == expected - def test_surrogate_pair(self): + def test_lone_surrogate(self): import _pypyjson json = '{"a":"\\uD83D"}' res = _pypyjson.loads(json) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit