
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2016-04-26 04:40 byoconnor663, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Messages (5) | |||
|---|---|---|---|
| msg264212 -(view) | Author: Jack O'Connor (oconnor663)* | Date: 2016-04-26 04:40 | |
Setting stdin=PIPE and then calling communicate(b"") should close the child's stdin immediately, similar to stdin=DEVNULL. Instead, communicate() treats b"" like None and leaves the child's stdin open, which makes the child hang forever if it tries to read anything.I have a PR open with a fix and a test:https://github.com/python/cpython/pull/33 | |||
| msg264213 -(view) | Author: Berker Peksag (berker.peksag)*![]() | Date: 2016-04-26 04:59 | |
python/cpython is a semi-official read-only mirror of hg.python.org/cpython. We haven't switched to GitHub yet. You may want to open a pull request tohttps://github.com/python/asyncio Seehttps://github.com/python/asyncio/wiki/Contributing for details. | |||
| msg264214 -(view) | Author: Jack O'Connor (oconnor663)* | Date: 2016-04-26 05:24 | |
Thanks for the heads up, Berker, I've re-submitted the PR ashttps://github.com/python/asyncio/pull/335. | |||
| msg264215 -(view) | Author: Jack O'Connor (oconnor663)* | Date: 2016-04-26 05:25 | |
Related: The asyncio communicate() method differs from standard subprocess in how it treats input bytes when stdin is (probably mistakenly) not set to PIPE. Like this: proc = await create_subprocess_shell("sleep 5") await proc.communicate(b"foo") # Oops, I forgot stdin=PIPE above!The standard, non-async version of this example, communicate would ignore the input bytes entirely. But here in the asyncio version, communicate will try to write those bytes to stdin, which is None, and the result is an AttributeError.Since the user probably only hits this case by mistake, I think raising an exception is preferable. But it would be nice to raise an exception that explicitly said "you've forgotten stdin=PIPE" instead of the unhelpful "'NoneType' object has no attribute 'write'". Maybe it would be worth cleaning this up while we're here? | |||
| msg265487 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2016-05-13 19:39 | |
New changeset148757a88f19 by Yury Selivanov in branch '3.5':Issue#26848: Fix asyncio/subprocess.communicate() to handle empty input.https://hg.python.org/cpython/rev/148757a88f19New changesetf5e69e2f50d7 by Yury Selivanov in branch 'default':Merge 3.5 (issue#26848)https://hg.python.org/cpython/rev/f5e69e2f50d7 | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:30 | admin | set | github: 71035 |
| 2016-05-14 01:42:18 | berker.peksag | set | status: open -> closed resolution: fixed stage: resolved |
| 2016-05-13 19:39:18 | python-dev | set | nosy: +python-dev messages: +msg265487 |
| 2016-04-26 05:25:15 | oconnor663 | set | messages: +msg264215 |
| 2016-04-26 05:24:35 | oconnor663 | set | messages: +msg264214 |
| 2016-04-26 04:59:55 | berker.peksag | set | nosy: +berker.peksag messages: +msg264213 |
| 2016-04-26 04:40:33 | oconnor663 | create | |