You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
update subprocess docs to reference io.TextIOWrapper #59766
io module experts: Can one of you review this minor change to the subprocess documentation to make it reference the newly added io.TextIOWrapper documentation changes?
For background purposes, digging back, it looks like the original change to subprocess was made here: 9ce8fa0a0899
In the process of working on bpo-15595, I noticed that the documentation change will need to be slightly different for Python 3.2 than for 3.3. In 3.2, it is locale.getpreferredencoding() (which defaults to do_setlocale=True) instead of locale.getpreferredencoding(False).
Hmm. As I can see in subprocess.py TextIOWrapper is applied to stdin also in non-buffered (write_through=True) mode. So input will be converted to use '\n' as well.
Sure. (Though for stdin '\n' is converted to os.linesep and no more.)
Would you mind if I also updated the following part of the subprocess documentation to reference the part we are updating, so that the documentation is just in one place?
"If universal_newlines is True, the file objects stdout and stderr are opened as text files, but lines may be terminated by any of '\n', the Unix end-of-line convention, '\r', the old Macintosh convention or '\r\n', the Windows convention. All of these external representations are seen as '\n' by the Python program."
The part we're updating is in the "Frequently Used Arguments" section and so seems like the natural place for expanded details.
Here is the patch for the default/3.3 branch, which for convenience is a diff for the branch *after the 3.2 patch has been forward-ported to 3.3*.
I did not think it was necessary to mention write_through specifically since it seems more like an implementation detail (though stdin as a whole is now documented).
Fixed.
BTW I prefer to use «stream» as alias to file object it subprocess context. «file» can clash with «the real file in filesystem» for documentation reader.
Activity
cjerdonek commentedon Aug 5, 2012
This is an issue to update the subprocess module documentation after updates to io.TextIOWrapper's documentation here:
http://hg.python.org/cpython/rev/f17a1410ebe5
This issue was discussed briefly on python-dev:
http://mail.python.org/pipermail/python-dev/2012-August/121239.html
Patch attached.
cjerdonek commentedon Aug 6, 2012
Victor, would you be able to take a look at this minor documentation patch? It incorporates the change that you suggested we make on python-dev.
cjerdonek commentedon Aug 8, 2012
io module experts: Can one of you review this minor change to the subprocess documentation to make it reference the newly added io.TextIOWrapper documentation changes?
For background purposes, digging back, it looks like the original change to subprocess was made here: 9ce8fa0a0899
cjerdonek commentedon Aug 9, 2012
In the process of working on bpo-15595, I noticed that the documentation change will need to be slightly different for Python 3.2 than for 3.3. In 3.2, it is locale.getpreferredencoding() (which defaults to do_setlocale=True) instead of locale.getpreferredencoding(False).
I will provide a patch adjusted for 3.2.
asvetlov commentedon Aug 9, 2012
Please do.
cjerdonek commentedon Aug 9, 2012
I have uploaded updated patches for both 3.2 and the default branch. Thanks, Andrew.
asvetlov commentedon Aug 11, 2012
Hmm. As I can see in subprocess.py TextIOWrapper is applied to stdin also in non-buffered (write_through=True) mode. So input will be converted to use '\n' as well.
Can you reflect this fact in your patches?
cjerdonek commentedon Aug 11, 2012
Sure. (Though for stdin '\n' is converted to os.linesep and no more.)
Would you mind if I also updated the following part of the subprocess documentation to reference the part we are updating, so that the documentation is just in one place?
"If universal_newlines is True, the file objects stdout and stderr are opened as text files, but lines may be terminated by any of '\n', the Unix end-of-line convention, '\r', the old Macintosh convention or '\r\n', the Windows convention. All of these external representations are seen as '\n' by the Python program."
The part we're updating is in the "Frequently Used Arguments" section and so seems like the natural place for expanded details.
asvetlov commentedon Aug 13, 2012
Do you mean to mention stdin as well as stdout/stderr? It will be nice.
cjerdonek commentedon Aug 13, 2012
Yes, that too. :) I am working on it.
cjerdonek commentedon Aug 13, 2012
For 3.2 to mention write_through, bpo-15638 should probably be fixed first. I can create a patch for that first.
cjerdonek commentedon Aug 13, 2012
In 3.2, I will not mention the write_through argument based on Antoine's response to bpo-15638.
cjerdonek commentedon Aug 13, 2012
Andrew, here is the new patch for 3.2. 3.3 will come shortly after.
cjerdonek commentedon Aug 13, 2012
Here is the patch for the default/3.3 branch, which for convenience is a diff for the branch *after the 3.2 patch has been forward-ported to 3.3*.
I did not think it was necessary to mention write_through specifically since it seems more like an implementation detail (though stdin as a whole is now documented).
python-dev commentedon Aug 13, 2012
New changeset 381aaf79c254 by Andrew Svetlov in branch '3.2':
Issue bpo-15561: Update subprocess docs to reference io.TextIOWrapper.
http://hg.python.org/cpython/rev/381aaf79c254
New changeset 0cd9423770fa by Andrew Svetlov in branch 'default':
Issue bpo-15561: Update subprocess docs to reference io.TextIOWrapper.
http://hg.python.org/cpython/rev/0cd9423770fa
asvetlov commentedon Aug 13, 2012
Fixed.
BTW I prefer to use «stream» as alias to file object it subprocess context. «file» can clash with «the real file in filesystem» for documentation reader.
cjerdonek commentedon Aug 13, 2012
Thanks a lot, Andrew. Yes, I agree and actually contemplated doing that myself.