msg82523 - (view) |
Author: Jani Hakala (jahakala) |
Date: 2009-02-20 09:14 |
The implementation in python 2.6 expects the cmd argument to be a string. The documentation - help(os.popen3) - states that the cmd argument can be a sequence on Unix. This difference may cause programs that work with python 2.5 to fail with python 2.6 I have tested the patch attached with one of my scripts that failed with python 2.6 and the fix appears to work. |
|
|
msg82567 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2009-02-21 14:24 |
Adding a couple of unit tests would be nice. |
|
|
msg90259 - (view) |
Author: Max Bowsher (maxb) |
Date: 2009-07-08 08:15 |
With or without tests, this is a regression from Python 2.5 - shouldn't something be done about that? |
|
|
msg90266 - (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) *  |
Date: 2009-07-08 13:22 |
The test is the proof the the regression, and shows the change in behavior and the purpose of the development. There happens to be a test for os.popen3 (in Lib/test/test_popen2.py) which passes a list; this one at least passes. os.popen3() accepts a sequence, except that since 2.6, the first item is the whole command string, and additional items are treated as additional shell arguments! Your patch is correct. A unit test could be: w, r, e = os.popen3(['echo', 'hello']) assert r.read() == 'hello\n' And should be disabled on non-posix platforms. |
|
|
msg92008 - (view) |
Author: Jean-Paul Calderone (exarkun) *  |
Date: 2009-08-27 16:44 |
Attached os-popen-list.patch which includes all of the earlier os-popen.diff and adds tests which fail without this patch and pass with it. They also pass on Python 2.5. The patch is against the Python 2.6 maintenance branch, but presumably it should be applied to trunk as well. |
|
|
msg92227 - (view) |
Author: Philip Jenvey (pjenvey) *  |
Date: 2009-09-04 02:37 |
The subprocess docs (in Doc/library/subprocess.rst and the module itself) need to also reflect this change |
|
|
msg92228 - (view) |
Author: Jean-Paul Calderone (exarkun) *  |
Date: 2009-09-04 02:51 |
Hey Philip, I'm not sure I follow. The patch only changes the os module, not the subprocess module. What subprocess documentation do you think needs to be updated? |
|
|
msg92229 - (view) |
Author: Philip Jenvey (pjenvey) *  |
Date: 2009-09-04 02:59 |
Sorry, I meant the docs describing how to convert os.popen* calls to subprocess calls. They assume the shell arg is always True regardless of the cmd arg type. Those docs are probably the original source of this bug |
|
|
msg92279 - (view) |
Author: Jean-Paul Calderone (exarkun) *  |
Date: 2009-09-05 15:13 |
Ah, thanks for the clarification, Philip. I've attached another patch updating those docs. |
|
|
msg93304 - (view) |
Author: Philip Jenvey (pjenvey) *  |
Date: 2009-09-29 17:17 |
Here's the doc change with a lil more clarification, and I've also applied it to the module's own docs |
|
|
msg93318 - (view) |
Author: Philip Jenvey (pjenvey) *  |
Date: 2009-09-29 19:19 |
applied in r75143/r75144, in time for 2.6.3. thanks! |
|
|