This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年08月14日 15:47 by asvetlov, last changed 2022年04月11日 14:57 by admin.
| Messages (6) | |||
|---|---|---|---|
| msg168207 - (view) | Author: Andrew Svetlov (asvetlov) * (Python committer) | Date: 2012年08月14日 15:47 | |
Currently Popen.communicate accept str is universal_newlines==True and bytes if universal_newlines==False. I like to accept both str and bytes if universal_newlines is False and raise explicit exception for bytes if universal_newlines is True. Looks like universal_newlines for bytes doesn't make sense, also we prefer to use str everywhere. Bytes should be used if it is really byte-stream or if unicode cannot be passed by some limitations of underlying OS etc. There are couple dark corners: 1. What to do if stdin doesn't have `encoding` attribute? Convert to bytes using filesystemencoding? Raise explicit exception? Adding `encode` parameter for .communicate doesn't looks elegant. 2. How .communicate works on Windows? I see completely different implementation of this method for win32. |
|||
| msg168211 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年08月14日 16:35 | |
> What to do if stdin doesn't have `encoding` attribute? Convert to bytes using filesystemencoding? If choosing an encoding, it probably makes sense to default to the same as for when universal_newlines=True, namely locale.getpreferredencoding(False). > Adding `encode` parameter for .communicate doesn't looks elegant. Also see issue 6135 (to allow setting encoding). |
|||
| msg168264 - (view) | Author: Ramchandra Apte (Ramchandra Apte) * | Date: 2012年08月15日 07:19 | |
Uhum.. Universal Newlines is being deprecated. |
|||
| msg168265 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年08月15日 07:36 | |
No it isn't. There's some issue about a 'U' parameter somewhere that is being deprecated, but that has nothing to do with this issue. |
|||
| msg179426 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年01月09日 09:29 | |
See also issue16903. |
|||
| msg268339 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2016年06月12日 07:35 | |
See also Issue 27273, proposing to use text string input as an indicator to turn on universal_newlines=True in the higher-level functions. I’m not excited by either proposal, but I find the other one a bit more palatable. IMO allowing text string input to communicate(), but returning byte string outputs would be a bad idea. It would have been better to call the universal_newlines=... flag "text_mode". |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:34 | admin | set | github: 59854 |
| 2016年06月12日 07:35:03 | martin.panter | set | nosy:
+ martin.panter messages: + msg268339 |
| 2013年01月09日 09:29:45 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg179426 |
| 2012年08月18日 13:41:16 | Arfrever | set | nosy:
+ Arfrever |
| 2012年08月15日 07:36:56 | r.david.murray | set | messages: + msg168265 |
| 2012年08月15日 07:19:22 | Ramchandra Apte | set | nosy:
+ Ramchandra Apte messages: + msg168264 |
| 2012年08月15日 02:10:45 | eric.araujo | set | nosy:
+ r.david.murray |
| 2012年08月14日 16:35:39 | chris.jerdonek | set | nosy:
+ chris.jerdonek messages: + msg168211 |
| 2012年08月14日 15:49:26 | asvetlov | set | components: + Library (Lib) |
| 2012年08月14日 15:47:00 | asvetlov | create | |