[pypy-svn] pypy default: newlines from incremental newline decoder should be unicode.
alex_gaynor
commits-noreply at bitbucket.org
Mon Jan 31 17:09:28 CET 2011
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch:
Changeset: r41498:c2879bb66a91
Date: 2011-01-31 11:07 -0500
http://bitbucket.org/pypy/pypy/changeset/c2879bb66a91/
Log: newlines from incremental newline decoder should be unicode.
diff --git a/pypy/module/_io/interp_textio.py b/pypy/module/_io/interp_textio.py
--- a/pypy/module/_io/interp_textio.py
+++ b/pypy/module/_io/interp_textio.py
@@ -28,17 +28,17 @@
def __init__(self, space):
self.w_newlines_dict = {
- SEEN_CR: space.wrap("\r"),
- SEEN_LF: space.wrap("\n"),
- SEEN_CRLF: space.wrap("\r\n"),
+ SEEN_CR: space.wrap(u"\r"),
+ SEEN_LF: space.wrap(u"\n"),
+ SEEN_CRLF: space.wrap(u"\r\n"),
SEEN_CR | SEEN_LF: space.newtuple(
- [space.wrap("\r"), space.wrap("\n")]),
+ [space.wrap(u"\r"), space.wrap(u"\n")]),
SEEN_CR | SEEN_CRLF: space.newtuple(
- [space.wrap("\r"), space.wrap("\r\n")]),
+ [space.wrap(u"\r"), space.wrap(u"\r\n")]),
SEEN_LF | SEEN_CRLF: space.newtuple(
- [space.wrap("\n"), space.wrap("\r\n")]),
+ [space.wrap(u"\n"), space.wrap(u"\r\n")]),
SEEN_CR | SEEN_LF | SEEN_CRLF: space.newtuple(
- [space.wrap("\r"), space.wrap("\n"), space.wrap("\r\n")]),
+ [space.wrap(u"\r"), space.wrap(u"\n"), space.wrap(u"\r\n")]),
}
@unwrap_spec('self', ObjSpace, W_Root, int, W_Root)
diff --git a/pypy/module/_io/test/test_io.py b/pypy/module/_io/test/test_io.py
--- a/pypy/module/_io/test/test_io.py
+++ b/pypy/module/_io/test/test_io.py
@@ -313,6 +313,7 @@
res = f.readline()
assert res == "world\n"
assert f.newlines == "\n"
+ assert type(f.newlines) is unicode
def test_custom_decoder(self):
import codecs
More information about the Pypy-commit
mailing list