[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-22 Thread Roundup Robot
Roundup Robot added the comment: New changeset 5c45d0ca984f by Serhiy Storchaka in branch 'default': Issue #16624: `subprocess.check_output` now accepts an `input` argument, http://hg.python.org/cpython/rev/5c45d0ca984f -- nosy: +python-dev ___

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thanks Zack for you patch. Thanks Mark for testing. -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Mark Lawrence
Mark Lawrence added the comment: The patch doesn't apply cleanly on Windows. Trying to sort this with TortoiseHg has left me completely flummoxed so can I leave this with the OP to provide a new patch? -- nosy: +BreamoreBoy ___ Python tracker

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Zack Weinberg
Zack Weinberg added the comment: Here is a new patch vs latest trunk. -- Added file: http://bugs.python.org/file29924/issue16624-v34a.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Zack Weinberg
Changes by Zack Weinberg za...@panix.com: Removed file: http://bugs.python.org/file28247/issue16624-v34.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624 ___

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think that it will be better not introduce a new argument, but reuse stdin. Just allow io.BytesIO (or perhaps even any file object) be specified as stdin. The change will be straightforward: if isinstance(stdin, io.BytesIO): inputdata = stdin.read()

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Zack Weinberg
Zack Weinberg added the comment: I think that it will be better not introduce a new argument, but reuse stdin. Just allow io.BytesIO (or perhaps even any file object) be specified as stdin. If we were designing from scratch I might agree, but we aren't. Principle of least astonishment says

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Zack Weinberg
Zack Weinberg added the comment: Note also that allowing `stdin=any filelike` in a clean fashion would require rather more surgery than you suggest, because a filelike can produce an infinite stream of data, and people would expect that to work when the subprocess only reads a finite prefix;

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I partially agree with you. We must copy blocks in communicate(). Your patch is great, but I doubt that there is a best feature. If we teach communicate() to work with file-like objects, this feature will exceed your suggestion and 'input' parameter of

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Zack Weinberg
Zack Weinberg added the comment: My position is: * input= should be supported in check_output(), for consistency with communicate(). * I like the idea of making stdin= support file-like objects which don't have a fileno, in both communicate() and everything that calls it, but that does not

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread R. David Murray
R. David Murray added the comment: Since it is a new feature either way, we can add stdin support and deprecate the input= argument of communicate. But we can also go with the input= for check_output now, and see if anyone steps up to do the bigger patch before 3.4 hits beta. Which is what

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Zack Weinberg
Zack Weinberg added the comment: ??? communicate() has always had input= AFAIK. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624 ___ ___

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread R. David Murray
R. David Murray added the comment: Yes. IIUC are talking about possibly replacing it with a more powerful feature. We wouldn't actually remove it, but we would recommend using the new feature instead, thus making the fact that check_output doesn't have it irrelevant. --

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Zack Weinberg
Zack Weinberg added the comment: OK, I get that, but what I'm saying is I think input= is still desirable even if stdin= becomes more powerful. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Mark Lawrence
Mark Lawrence added the comment: Tests rerun on Windows and were fine. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624 ___ ___

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread R. David Murray
R. David Murray added the comment: Why? What is the use case that it serves better? I'm not saying there isn't one, but one isn't occurring to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-01-28 Thread Zack Weinberg
Zack Weinberg added the comment: Contributor agreement resent by email. Sorry for the delay. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624 ___

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-01-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Zack, can you please resend your agreement by email? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624 ___

[issue16624] subprocess.check_output should allow specifying stdin as a string

2012-12-29 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624 ___ ___

[issue16624] subprocess.check_output should allow specifying stdin as a string

2012-12-07 Thread Zack Weinberg
Zack Weinberg added the comment: OK, here is a patch against the latest development version. Now also with tests and documentation updates. -- Added file: http://bugs.python.org/file28247/issue16624-v34.diff ___ Python tracker

[issue16624] subprocess.check_output should allow specifying stdin as a string

2012-12-07 Thread Zack Weinberg
Changes by Zack Weinberg za...@panix.com: Removed file: http://bugs.python.org/file28218/subprocess-check-output-allow-input.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624 ___

[issue16624] subprocess.check_output should allow specifying stdin as a string

2012-12-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is a beautiful patch. LGTM. However it should be tested on Windows. I'm not sure that reading not closed file in different process works on Windows. Zack, can you please submit a contributor form? http://python.org/psf/contrib/contrib-form/

[issue16624] subprocess.check_output should allow specifying stdin as a string

2012-12-07 Thread Zack Weinberg
Zack Weinberg added the comment: I don't have the ability to test on Windows, but the construct you are concerned about was copied from other tests in the same file which were not marked as Unix-only. I have faxed in a contributor agreement. --

[issue16624] subprocess.check_output should allow specifying stdin as a string

2012-12-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: 2.7 is in bugfix only mode. Please update your patch to 3.4. -- nosy: +serhiy.storchaka stage: - needs patch versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624

[issue16624] subprocess.check_output should allow specifying stdin as a string

2012-12-05 Thread Zack Weinberg
New submission from Zack Weinberg: subprocess.check_output calls Popen.communicate but does not allow you to specify its argument (i.e. data to send to the child process's stdin). It would be nice if it were enhanced to allow this. Proposed patch attached (to the 2.7 subprocess.py; should