[Python-ideas] Subprocess: Add an encoding argument
Nick Coghlan
ncoghlan at gmail.com
Sun Aug 31 01:30:32 CEST 2014
On 30 Aug 2014 21:08, "Antoine Pitrou" <solipsis at pitrou.net> wrote:
>
> On Fri, 29 Aug 2014 18:39:35 +1000
> Nick Coghlan <ncoghlan at gmail.com> wrote:
> >
> > This actually gets a little messy once you start digging into it, as you
> > actually have up to 3 streams to deal with (stdin, stdout, stderr), and
may
> > want to set the error handler in addition to the encoding.
>
> At this point, I'd suggest creating a clean, separate TextPopen class
> (or subclass) without any legacy argument baggage.
>
> As for per-stream settings, we could allow passing each of *encoding*
> and *errors* in two forms:
> - as a string, in which case it applies to all three pipes
> - as a dict, in which case it is looked up for each of the "stdin",
> "stdout", "stderr" pipes (if configured as pipes)
>
> We could then deprecate the bogus-named "universal_newlines" in the
> main Popen class.
That sounds like a plausible plan to me - splitting the API like that also
reflects what was needed to get IO working sensibly in the first place.
Cheers,
Nick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140831/4015949e/attachment.html>
More information about the Python-ideas
mailing list