[pypy-commit] pypy unicode-utf8-py3: test, fix for passing in public_encoder_name (and refactor)
mattip
pypy.commits at gmail.com
Sun Dec 2 11:52:07 EST 2018
Author: Matti Picus <matti.picus at gmail.com>
Branch: unicode-utf8-py3
Changeset: r95397:6e92ce356ff6
Date: 2018-11-29 14:23 -0800
http://bitbucket.org/pypy/pypy/changeset/6e92ce356ff6/
Log: test, fix for passing in public_encoder_name (and refactor)
diff --git a/pypy/interpreter/unicodehelper.py b/pypy/interpreter/unicodehelper.py
--- a/pypy/interpreter/unicodehelper.py
+++ b/pypy/interpreter/unicodehelper.py
@@ -1042,15 +1042,18 @@
def str_decode_utf_16(s, errors, final=True,
errorhandler=None):
- return str_decode_utf_16_helper(s, errors, final, errorhandler, "native")[:3]
+ return str_decode_utf_16_helper(s, errors, final, errorhandler,
+ "native")[:3]
def str_decode_utf_16_be(s, errors, final=True,
errorhandler=None):
- return str_decode_utf_16_helper(s, errors, final, errorhandler, "big")[:3]
+ return str_decode_utf_16_helper(s, errors, final, errorhandler, "big",
+ 'utf16-be')[:3]
def str_decode_utf_16_le(s, errors, final=True,
errorhandler=None):
- return str_decode_utf_16_helper(s, errors, final, errorhandler, "little")[:3]
+ return str_decode_utf_16_helper(s, errors, final, errorhandler, "little",
+ 'utf16-le')[:3]
def str_decode_utf_16_helper(s, errors, final=True,
errorhandler=None,
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
@@ -654,6 +654,8 @@
b'\x00\x00\xd8\xae')
assert (u'\x80\ud800'.encode('utf8', 'surrogatepass') ==
b'\xc2\x80\xed\xa0\x80')
+ assert b'\xd8\x03\xdf\xff\xdc\x80\x00A'.decode('utf_16_be',
+ 'surrogatepass') == u'\U00010fff\udc80A'
def test_badandgoodsurrogatepassexceptions(self):
import codecs
More information about the pypy-commit
mailing list