Skip to content

gh-139373: Fix asyncio Process.communicate() losing output when cancelled#154223

Merged
kumaraditya303 merged 1 commit into
python:mainfrom
kumaraditya303:gh-139373-communicate-cancel-safety
Jul 21, 2026
Merged

gh-139373: Fix asyncio Process.communicate() losing output when cancelled#154223
kumaraditya303 merged 1 commit into
python:mainfrom
kumaraditya303:gh-139373-communicate-cancel-safety

Conversation

@kumaraditya303

@kumaraditya303 kumaraditya303 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Output already read when communicate() is cancelled (e.g. by a wait_for() timeout) is now retained on the Process and returned by a subsequent communicate() call, matching subprocess.Popen.communicate() behaviour on timeout. Passing input to a communicate() call following a cancelled one now raises ValueError.

… cancelled

Output already read when communicate() is cancelled (e.g. by a
wait_for() timeout) is now retained on the Process and returned by a
subsequent communicate() call, matching subprocess.Popen.communicate()
behaviour on timeout. Passing input to a communicate() call following a
cancelled one now raises ValueError.
@kumaraditya303
kumaraditya303 force-pushed the gh-139373-communicate-cancel-safety branch from b331984 to 301e3f3 Compare July 20, 2026 07:24
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33661886 | 📁 Comparing 301e3f3 against main (2875d1d)

  🔍 Preview build  

2 files changed
± library/asyncio-subprocess.html
± whatsnew/changelog.html

@kumaraditya303
kumaraditya303 merged commit 027a833 into python:main Jul 21, 2026
51 checks passed
@kumaraditya303
kumaraditya303 deleted the gh-139373-communicate-cancel-safety branch July 21, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant