Author: Alexander Hesse <[email protected]>
Branch: split-rpython
Changeset: r60115:daaeb86c9502
Date: 2013-01-17 00:52 +0100
http://bitbucket.org/pypy/pypy/changeset/daaeb86c9502/
Log: hg merge default
diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py
--- a/rpython/rlib/runicode.py
+++ b/rpython/rlib/runicode.py
@@ -460,6 +460,10 @@
errorhandler=None,
byteorder='little'):
if size == 0:
+ if byteorder == 'native':
+ result = StringBuilder(2)
+ _STORECHAR(result, 0xFEFF, BYTEORDER)
+ return result.build()
return ""
result = StringBuilder(size * 2 + 2)
@@ -621,6 +625,10 @@
errorhandler=None,
byteorder='little'):
if size == 0:
+ if byteorder == 'native':
+ result = StringBuilder(4)
+ _STORECHAR32(result, 0xFEFF, BYTEORDER)
+ return result.build()
return ""
result = StringBuilder(size * 4 + 4)
diff --git a/rpython/rlib/test/test_runicode.py
b/rpython/rlib/test/test_runicode.py
--- a/rpython/rlib/test/test_runicode.py
+++ b/rpython/rlib/test/test_runicode.py
@@ -679,6 +679,11 @@
"utf-32 utf-32-be utf-32-le").split():
self.checkencode(uni, encoding)
+ def test_empty(self):
+ for encoding in ("utf-8 utf-16 utf-16-be utf-16-le "
+ "utf-32 utf-32-be utf-32-le").split():
+ self.checkencode(u'', encoding)
+
def test_single_chars_utf8(self):
# check every number of bytes per char
for s in ["\xd7\x90", "\xd6\x96", "\xeb\x96\x95", "\xf0\x90\x91\x93"]:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit