[issue13342] input() builtin always uses "strict" error handler

2011-11-05 Thread Antoine Pitrou
Antoine Pitrou added the comment: Committed. I hope the test won't disturb the buildbots. -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker __

[issue13342] input() builtin always uses "strict" error handler

2011-11-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset 421c8e291221 by Antoine Pitrou in branch '3.2': Issue #13342: input() used to ignore sys.stdin's and sys.stdout's unicode http://hg.python.org/cpython/rev/421c8e291221 New changeset 992ba03d60a8 by Antoine Pitrou in branch 'default': Issue #13342:

[issue13342] input() builtin always uses "strict" error handler

2011-11-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I can make it work at the interpreter prompt with your patch applied. > Sorry for cluttering up the ticket. ;-) That's ok, thanks a lot for testing. -- ___ Python tracker _

[issue13342] input() builtin always uses "strict" error handler

2011-11-04 Thread Stefan Holek
Stefan Holek added the comment: I can make it work at the interpreter prompt with your patch applied. Sorry for cluttering up the ticket. ;-) -- ___ Python tracker ___

[issue13342] input() builtin always uses "strict" error handler

2011-11-04 Thread Stefan Holek
Stefan Holek added the comment: Oops, the last one wasn't meant for the bug tracker. -- ___ Python tracker ___ ___ Python-bugs-list

[issue13342] input() builtin always uses "strict" error handler

2011-11-04 Thread Stefan Holek
Stefan Holek added the comment: Python 3.2.2 (default, Nov 4 2011, 22:28:55) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys, io >>> w = io.TextIOWrapper(sys.stdin.detach(), 'ascii', 'replace') >>> inpu

[issue13342] input() builtin always uses "strict" error handler

2011-11-04 Thread Stefan Holek
Stefan Holek added the comment: This is with Python 3.2.2 on Mac OS X 10.6 (SL). I have built Python from source with: ./configure; make; make install. -- ___ Python tracker __

[issue13342] input() builtin always uses "strict" error handler

2011-11-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: > However when I try your example I get > > sys.stdin = io.TextIOWrapper( > sys.stdin.detach(), 'ascii', 'replace') > ValueError: underlying buffer has been detached Which version of Python (and which OS?). It works fine here on latest 3.2 and 3.3 branches

[issue13342] input() builtin always uses "strict" error handler

2011-11-04 Thread stefanholek
stefanholek added the comment: Thank you Antoine, this looks good. However when I try your example I get sys.stdin = io.TextIOWrapper( sys.stdin.detach(), 'ascii', 'replace') ValueError: underlying buffer has been detached -- ___ Python track

[issue13342] input() builtin always uses "strict" error handler

2011-11-04 Thread Charles-François Natali
Charles-François Natali added the comment: > The bugfix itself is quite pedestrian, but the test is more interesting. Indeed. Looks good to me. -- ___ Python tracker ___ __

[issue13342] input() builtin always uses "strict" error handler

2011-11-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: Here is a patch. The bugfix itself is quite pedestrian, but the test is more interesting. I did what I could to fork a subprocess into a pseudoterminal so as to trigger the GNU readline code path. The only limitation I've found is that I'm unable to read furt

[issue13342] input() builtin always uses "strict" error handler

2011-11-04 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue13342] input() builtin always uses "strict" error handler

2011-11-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: > There cannot be a reason input() should be confined to "strict", or can > there? ;-) Actually, there's a good reason: in the non-interactive case, input() simply calls sys.stdin.read(), which doesn't have encoding or errors attributes. You want to override

[issue13342] input() builtin always uses "strict" error handler

2011-11-04 Thread stefanholek
stefanholek added the comment: I am not quite sure how I would write a custom, readline-using input function in Python (access to PyOS_Readline seems required), that's why I did it in C. Have an example? -- ___ Python tracker

[issue13342] input() builtin always uses "strict" error handler

2011-11-04 Thread Benjamin Peterson
Benjamin Peterson added the comment: There's no reason you couldn't write your own input() function in Python to do this. -- nosy: +benjamin.peterson ___ Python tracker ___ ___

[issue13342] input() builtin always uses "strict" error handler

2011-11-04 Thread stefanholek
New submission from stefanholek : The input builtin always uses "strict" error handling for Unicode conversions. This means that when I enter a latin-1 string in a utf-8 environment, input breaks with a UnicodeDecodeError. Now don't tell me not to do that, I have a valid use-case. ;-) While "