[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset 4621bb82ceec by Antoine Pitrou in branch '3.4': Issue #21364: remove recommendation of broken pattern. http://hg.python.org/cpython/rev/4621bb82ceec New changeset dbf728f9a2f0 by Antoine Pitrou in branch 'default': Issue #21364: remove

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: Thanks for the report, Armin. I've removed that recommendation and changed the surrounding wording to insist that standard streams are always text streams. -- resolution: - fixed stage: - resolved status: open - closed

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread Armin Ronacher
Armin Ronacher added the comment: To avoid further problems may I also recommend documenting how exactly people are supposed to wrap sys.stdout and so forth. Clearly putting a StringIO there is insufficient as StringIO does not have a buffer. Something like this maybe? import io buf =

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: To avoid further problems may I also recommend documenting how exactly people are supposed to wrap sys.stdout and so forth. Clearly putting a StringIO there is insufficient as StringIO does not have a buffer. I would like to know of some situations where

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread Armin Ronacher
Armin Ronacher added the comment: I would like to know of some situations where you want to write some code that accesses standard streams as binary *and* don't control the application setup (i.e. library code rather than application code). It seems to me that a library should take the

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread Armin Ronacher
Armin Ronacher added the comment: Pretty much, yes. Just that you probably want 'replace' instead. surrogate-escape does not do anything useful here I think. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21364

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: The same situations people wrapped streams before on python 2: * code.py users. Werkzeug's traceback system implements a remote python shell through it. * any system that wants to unittest shell scripts on a high level. * any system that wants to

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread R. David Murray
R. David Murray added the comment: Note that in 3.4 we have contextlib.replace_stdout, but it doesn't give any examples of how to construct file-like objects that will work well with it. -- ___ Python tracker rep...@bugs.python.org

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread R. David Murray
R. David Murray added the comment: I mean redirect_stdout. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21364 ___ ___ Python-bugs-list mailing

[issue21364] Documentation Recommends Broken Pattern

2014-05-14 Thread R. David Murray
R. David Murray added the comment: The issue of (mixed) string and binary input/output on the standard streams is still a bit of a work in progress, I think, both documentation wise and code wise. So I'm not sure we know yet what the best practice is to recommend here. I think I agree with

[issue21364] Documentation Recommends Broken Pattern

2014-05-14 Thread Armin Ronacher
Armin Ronacher added the comment: Sidestepping: The shutdown message is a related issue. TextIOWrapper tends to internally log errors apparently which is super annoying and probably should be fixed. I encountered the same problem with sockets disconnecting wrapped in TextIOWrapper always

[issue21364] Documentation Recommends Broken Pattern

2014-05-01 Thread Martin Panter
Martin Panter added the comment: That particular revision isn’t sound so bad; I think the next revision, 78fb7f8cd349, which adds the make_streams_binary() function that replaces the variables is a worry though. This is the kind of code I use when I want to write binary data to stdout:

[issue21364] Documentation Recommends Broken Pattern

2014-04-27 Thread Armin Ronacher
New submission from Armin Ronacher: The documentation recommends replacing sys.stdin with a binary stream currently: https://docs.python.org/3/library/sys.html#sys.stdin This sounds like a bad idea because it will break pretty much everything in Python in the process. As example: import

[issue21364] Documentation Recommends Broken Pattern

2014-04-27 Thread Florent Xicluna
Changes by Florent Xicluna florent.xicl...@gmail.com: -- components: +IO nosy: +benjamin.peterson, flox, hynek, pitrou, stutzbach type: - behavior versions: +Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org

[issue21364] Documentation Recommends Broken Pattern

2014-04-27 Thread Antoine Pitrou
Antoine Pitrou added the comment: Initial introduction is 59cb9c074e09. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21364 ___ ___