New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-83925: make asyncio.subprocess communicate similar to non-asyncio #18650
Conversation
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). CLA MissingOur records indicate the following people have not signed the CLA: For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
(CLA just signed, probably state not refreshed yet - will recheck tomorrow) |
d23078a
to
fbb5546
Compare
Codecov Report
@@ Coverage Diff @@
## master #18650 +/- ##
==========================================
- Coverage 82.12% 82.07% -0.06%
==========================================
Files 1956 1955 -1
Lines 589451 584109 -5342
Branches 44457 44458 +1
==========================================
- Hits 484065 479380 -4685
+ Misses 95737 95102 -635
+ Partials 9649 9627 -22
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @marmarek, Thanks for the PR. If you wish to move this PR forward, please fix the CI errors. Thanks!
c2d9dc3
to
4bf5647
Compare
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the logic is correct. This requires a test and a small doc update though. Can you take care of those?
@@ -0,0 +1 @@ | |||
Make func:``asyncio.subprocess.Process.communicate`` close subprocess's stdin even when called with input=None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make func:``asyncio.subprocess.Process.communicate`` close subprocess's stdin even when called with input=None | |
Make :func:`asyncio.subprocess.Process.communicate` close the subprocess's stdin even when called with `input=None`. |
Oh, there was also a missing :
before func
. Look at other uses of this syntax in the Doc tree for comparison.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just changed single quotes to double ones, because the build failed and said I need to use double ones...
(And by "small doc changes" I didn't mean the NEWS file edit; I would like the docs for |
@marmarek The docs page is at: https://github.com/python/cpython/blob/main/Doc/library/asyncio-subprocess.rst |
It seems the doc already describes the behavior after this patch:
And also the list of differences vs |
d863a4b
to
0272411
Compare
… one subprocess's communicate(None) closes stdin of the child process, after sending no (extra) data. Make asyncio variant do the same. This fixes issues with processes that waits for EOF on stdin before continuing.
0272411
to
9e9e37b
Compare
For now, let's just add a versionchanged note to the description of communicate(). And we won't backport the fix. We can update the 3.11 (and before) docs in a separate PR. |
Also, please don't force-push, it is confusing for reviewers. When we merge a PR we squash commits anyways. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still to do:
- Fix the NEWS file
- Add versionchanged note
f0b8dfc
to
4efe16b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
I'm not sure this should be backported to 3.11; people might have existing workarounds for the issue that could be broken. (Can you close stdin twice?) |
subprocess's communicate(None) closes stdin of the child process, after
sending no (extra) data. Make asyncio variant do the same.
This fixes issues with processes that waits for EOF on stdin before
continuing.
https://bugs.python.org/issue39744