[issue28647] python --help: -u is misdocumented as binary mode

2017-10-13 Thread Berker Peksag
Berker Peksag added the comment: Modules/main.c and Python.man is same in 3.6 branch. We could backport the change in Doc/library/sys.rst from 7f580970836b0f6bc9c5db868d95bea81a3e1558 but I didn't do it yet since it needs be manually backported. -- ___

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-13 Thread STINNER Victor
STINNER Victor added the comment: Thanks Berker for this nice documentation enhancement! It was required. Do we need to update Python 3.6 documentation using the commit 5f908005ce16b06d5af7b413264009c4b062f33c, or are we good? (sorry, I didn't check) -- _

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-13 Thread Berker Peksag
Berker Peksag added the comment: Thank you for reviews, Serhiy and Victor. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker __

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-13 Thread Berker Peksag
Berker Peksag added the comment: New changeset 7f580970836b0f6bc9c5db868d95bea81a3e1558 by Berker Peksag in branch 'master': bpo-28647: Update -u documentation after bpo-30404 (GH-3961) https://github.com/python/cpython/commit/7f580970836b0f6bc9c5db868d95bea81a3e1558 --

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Hum, I propose to mention stdin in -u documentation as: "The option has no > effect on stdin." What do you think? This LGTM too. More precise, it has no effect on stdin buffering. It has effect on the line_buffering attribute, but this attribute has no ef

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-12 Thread STINNER Victor
STINNER Victor added the comment: Serhiy: "I think there is no need to mention stdin in the context of the -u option at all. -u doesn't affect stdin buffering, whatever that would mean. Period." Hum, I propose to mention stdin in -u documentation as: "The option has no effect on stdin." What

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-12 Thread STINNER Victor
STINNER Victor added the comment: > I think we need to document behavior of stdin somewhere, because current the > sys.stdin documentation states: > >> When interactive, standard streams are line-buffered. Otherwise, they >> are block-buffered like regular text files. You can override this valu

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-12 Thread STINNER Victor
STINNER Victor added the comment: Interesting comment in create_stdio() of Python/pylifecycle.c: --- /* stdin is always opened in buffered mode, first because it shouldn't make a difference in common use cases, second because TextIOWrapper depends on the presence of a read1() m

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-12 Thread Berker Peksag
Berker Peksag added the comment: > -u doesn't affect stdin buffering, whatever that would mean. I think we need to document behavior of stdin somewhere, because current the sys.stdin documentation states: > When interactive, standard streams are line-buffered. Otherwise, they > are block-buff

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: stdin is mentioned in the documentation of the -u option only due to weird internal buffering in Python 2, because user can expect that -u disables it. It is documented what methods use internal buffering and how get rid of it. No other buffering is mention

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-12 Thread STINNER Victor
STINNER Victor added the comment: Serhiy Storchaka: https://github.com/python/cpython/pull/3961#issuecomment-336136160 "I suggest to continue the discussion on the tracker." Ok, let's continue here. "We are fixing the outdated documentation inherited from Python 2. First than keep some state

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-12 Thread STINNER Victor
STINNER Victor added the comment: Serhiy: "(...) I think it is more correct to say that stdin is always unbuffered in Python 3." I disagree. Technically, sys.stdin.read(1) reads up to 1024 bytes from the file descriptor 0. For me, "unbuffered read" means that read(1) reads a single byte. Exp

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: In Python 2 there is an internal buffering in xreadlines(), readlines() and file-object iterators. You need to enter many lines first that the program get the first of them. And -u doesn't help. But in Python 3 the program gets the input right as it becomes

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-12 Thread Berker Peksag
Berker Peksag added the comment: I think it's better to be explicit and mention 'stdin' in this case. Plus, "stdin is always buffered" is quite short so potential of creating noise is quite minimal IMO. (FYI, I asked this question on GitHub: https://github.com/python/cpython/pull/3961#issuec

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The -u option doesn't affect the buffering of stdin. Is it worth to document this explicitly? Or it just adds a noise? Maybe remove this from the help and manpage but add in the RST documentation? -- ___ Python t

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Don't forget to update Misc/python.man. -- ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-11 Thread Berker Peksag
Berker Peksag added the comment: Good catch, I thought it was already fixed in master after bpo-30404. I've opened PR 3961. -- ___ Python tracker ___ _

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-11 Thread Berker Peksag
Change by Berker Peksag : -- pull_requests: +3938 stage: resolved -> patch review ___ Python tracker ___ ___ Python-bugs-list mailing

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-11 Thread STINNER Victor
STINNER Victor added the comment: I just checked the master branch: -u : unbuffered binary stdout and stderr, stdin always buffered; also PYTHONUNBUFFERED=x see man page for details on internal buffering relating to '-u' The doc is wrong. stdout and stderr are fully unbuf

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-11 Thread Gareth Rees
Gareth Rees added the comment: You're welcome. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-11 Thread Berker Peksag
Berker Peksag added the comment: Thank you for the patch, Gareth. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-11 Thread Berker Peksag
Berker Peksag added the comment: New changeset 5f908005ce16b06d5af7b413264009c4b062f33c by Berker Peksag in branch '3.6': bpo-28647: Update -u documentation (GH-3954) https://github.com/python/cpython/commit/5f908005ce16b06d5af7b413264009c4b062f33c -- ___

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-11 Thread Berker Peksag
Berker Peksag added the comment: Pull request for issue 30404 has been merged so we only need the documentation patch for the 3.6 branch (unfortunately 3.5 is now in security-fix-only mode) I've opened PR 3954. -- versions: -Python 3.5, Python 3.7 ___

[issue28647] python --help: -u is misdocumented as binary mode

2017-10-11 Thread Berker Peksag
Change by Berker Peksag : -- pull_requests: +3929 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue28647] python --help: -u is misdocumented as binary mode

2017-05-24 Thread Armin Rigo
Changes by Armin Rigo : -- nosy: -arigo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.or

[issue28647] python --help: -u is misdocumented as binary mode

2017-05-24 Thread Stéphane Wirtel
Changes by Stéphane Wirtel : -- pull_requests: +1880 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue28647] python --help: -u is misdocumented as binary mode

2017-05-24 Thread Stéphane Wirtel
Changes by Stéphane Wirtel : -- pull_requests: +1879 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue28647] python --help: -u is misdocumented as binary mode

2017-05-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Issue30404 makes stdout and stderr truly unbuffered when run with -u. -- ___ Python tracker ___ __

[issue28647] python --help: -u is misdocumented as binary mode

2017-05-18 Thread Berker Peksag
Changes by Berker Peksag : -- pull_requests: +1749 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue28647] python --help: -u is misdocumented as binary mode

2017-03-15 Thread Nick Coghlan
Nick Coghlan added the comment: I just ran into this discrepancy working on the test cases for PEP 538 - +1 for Gareth's suggested approach of just aligning the `--help` output with the man page. -- nosy: +ncoghlan ___ Python tracker

[issue28647] python --help: -u is misdocumented as binary mode

2017-01-06 Thread Berker Peksag
Changes by Berker Peksag : -- nosy: +berker.peksag stage: -> patch review type: -> behavior versions: +Python 3.6, Python 3.7 ___ Python tracker ___ ___

[issue28647] python --help: -u is misdocumented as binary mode

2016-11-12 Thread Gareth Rees
Gareth Rees added the comment: Here's a patch that copies the text for the -u option from the man page to the --help output. -- keywords: +patch Added file: http://bugs.python.org/file45463/issue28647.patch ___ Python tracker

[issue28647] python --help: -u is misdocumented as binary mode

2016-11-12 Thread Gareth Rees
Gareth Rees added the comment: The output of "python3.5 --help" says: -u : unbuffered binary stdout and stderr, stdin always buffered; also PYTHONUNBUFFERED=x see man page for details on internal buffering relating to '-u' If you look at the man page as instructed then you

[issue28647] python --help: -u is misdocumented as binary mode

2016-11-09 Thread STINNER Victor
STINNER Victor added the comment: Would it make sense to have two modes: line buferred and unbuffered, as the C function setvbuf() for stdout? -- ___ Python tracker ___ _

[issue28647] python --help: -u is misdocumented as binary mode

2016-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The write_through argument was added only in 3.3. I think this is a good idea to pass `write_through = Py_True` when Py_UnbufferedStdioFlag is set. Using -u means that performance is not important (that is why this is not default behavior). -- nosy:

[issue28647] python --help: -u is misdocumented as binary mode

2016-11-09 Thread STINNER Victor
STINNER Victor added the comment: I don't recall, I would have to search in old issues for the rationale. But the explanation is probably performance, reduce the number of syscalls. -- ___ Python tracker __

[issue28647] python --help: -u is misdocumented as binary mode

2016-11-09 Thread Eryk Sun
Eryk Sun added the comment: > It's not (currently) possible to have a fully unbuffered stdout. Why doesn't create_stdio also pass `write_through = Py_True` when Py_UnbufferedStdioFlag is set? This would immediately pass writes through to the FileIO object, even without containing a newline (i.

[issue28647] python --help: -u is misdocumented as binary mode

2016-11-09 Thread STINNER Victor
STINNER Victor added the comment: Right. Moreover, "unbuffered" is wrong. It's line buffered: sys.stdout.buffer is directly a io.FileIO object, but TextIOWrapper only calls buffer.write() when the message contains a newline character. It's not (currently) possible to have a fully unbuffered st

[issue28647] python --help: -u is misdocumented as binary mode

2016-11-09 Thread Armin Rigo
New submission from Armin Rigo: ``python3.5 --help`` gives this information: -u : unbuffered binary stdout and stderr, stdin always buffered However, stdout and stderr are actually always opened in text mode, and print() always expects a string and never a bytes object. This usage of "bin