[issue20424] _pyio.StringIO doesn't work with lone surrogates

2014-01-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Victor.

--
assignee:  - serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20424
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20424] _pyio.StringIO doesn't work with lone surrogates

2014-01-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6ca9ba9eb76b by Serhiy Storchaka in branch '3.3':
Issue #20424: Python implementation of io.StringIO now supports lone surrogates.
http://hg.python.org/cpython/rev/6ca9ba9eb76b

New changeset 483096ef1cf6 by Serhiy Storchaka in branch 'default':
Issue #20424: Python implementation of io.StringIO now supports lone surrogates.
http://hg.python.org/cpython/rev/483096ef1cf6

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20424
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20424] _pyio.StringIO doesn't work with lone surrogates

2014-01-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The test is backported to 2.7 in 3971e1b07af4.

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20424
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20424] _pyio.StringIO doesn't work with lone surrogates

2014-01-28 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Unlike to io.StringIO, _pyio.StringIO doesn't work with lone surrogates.

 import io, _pyio
 io.StringIO('\ud880')
_io.StringIO object at 0xb71426ec
 _pyio.StringIO('\ud880')
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/serhiy/py/cpython/Lib/_pyio.py, line 2065, in __init__
self.write(initial_value)
  File /home/serhiy/py/cpython/Lib/_pyio.py, line 1629, in write
b = encoder.encode(s)
  File /home/serhiy/py/cpython/Lib/encodings/utf_8.py, line 20, in encode
return codecs.utf_8_encode(input, self.errors)[0]
UnicodeEncodeError: 'utf-8' codec can't encode character '\ud880' in position 
0: surrogates not allowed

Proposed patch adds support of lone surrogates to _pyio.StringIO.

--
components: IO, Unicode
files: stringio_lone_surrogates.patch
keywords: patch
messages: 209583
nosy: benjamin.peterson, ezio.melotti, haypo, hynek, pitrou, serhiy.storchaka, 
stutzbach
priority: normal
severity: normal
stage: patch review
status: open
title: _pyio.StringIO doesn't work with lone surrogates
type: behavior
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file33781/stringio_lone_surrogates.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20424
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20424] _pyio.StringIO doesn't work with lone surrogates

2014-01-28 Thread STINNER Victor

STINNER Victor added the comment:

I agree that StringIO should accept lone surrogates as str += str accept them.

The patch looks good, but please mention the issue number in the unit test. And 
add an empty line between the two parts of the test (reader, writer).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20424
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com