GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-138234: clarify returncode behavior for subprocess_exec vs subprocess_shell by andreuu-tsai · Pull Request #138536 · python/cpython

Conversation

@andreuu-tsai

@andreuu-tsai andreuu-tsai commented Sep 5, 2025 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Update asyncio.subprocess returncode documentation:

  • For create_subprocess_exec, negative values (-N) indicate termination by signal N (POSIX).
  • For create_subprocess_shell, the return code follows the invoked shell’s exit status (e.g. 128+N for signals in bash/sh).
  • Issue: asyncio.create_subprocess_shell does not consistently result in negative returncode on signal termination #138234

📚 Documentation preview 📚: https://cpython-previews--138536.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@andreuu-tsai
andreuu-tsai requested review from 1st1, asvetlov, kumaraditya303 and willingc as code owners September 5, 2025 08:52
@bedevere-app bedevere-app Bot added the awaiting review label Sep 5, 2025
@python-cla-bot

python-cla-bot Bot commented Sep 5, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news labels Sep 5, 2025
@github-project-automation github-project-automation Bot added this to Docs PRs Sep 5, 2025
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs Sep 5, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Sep 5, 2025
asyncio.create_subprocess_shell does not consistently result in negative returncode on signal termination #138234
Closed
@andreuu-tsai
andreuu-tsai force-pushed the doc-asyncio-subprocess-returncode-in-shell branch from b833aaf to 93cdda2 Compare September 5, 2025 09:44
@kumaraditya303
kumaraditya303 requested a review from gpshead September 5, 2025 11:19
gpshead
gpshead reviewed Sep 6, 2025
View reviewed changes

@gpshead gpshead left a comment

Copy link
Copy Markdown
Member

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.

there are several places in subprocess.rst itself that could be updated in a similar manner to mention the potential difference between shell=False (default) and shell=True.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
kumaraditya303
kumaraditya303 requested changes Oct 3, 2025
View reviewed changes

@kumaraditya303 kumaraditya303 left a comment

Copy link
Copy Markdown
Contributor

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.

awaiting subprocess docs changes and CLA

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting changes and removed awaiting review labels Oct 3, 2025
@bedevere-app

bedevere-app Bot commented Oct 3, 2025

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@andreuu-tsai
docs: clarify returncode behavior for subprocess_exec vs subprocess_s…
979128f
…hell

Update asyncio.subprocess returncode documentation:
- For create_subprocess_exec, negative values (-N) indicate termination by signal N (POSIX).
- For create_subprocess_shell, the return code follows the invoked shell’s exit status
  (e.g. 128+N for signals in bash/sh).
@andreuu-tsai
andreuu-tsai force-pushed the doc-asyncio-subprocess-returncode-in-shell branch from 5fac6df to 979128f Compare October 6, 2025 13:10
@kumaraditya303
Add note subprocess as well
4590558
kumaraditya303
kumaraditya303 approved these changes Mar 21, 2026
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting changes labels Mar 21, 2026
@kumaraditya303
kumaraditya303 enabled auto-merge (squash) March 21, 2026 12:16
@kumaraditya303 kumaraditya303 added topic-asyncio needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes labels Mar 21, 2026
@kumaraditya303
Merge branch 'main' into doc-asyncio-subprocess-returncode-in-shell
91c46ab
@kumaraditya303
kumaraditya303 merged commit 8a531f8 into python:main Mar 21, 2026
28 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Mar 21, 2026
@bedevere-app bedevere-app Bot removed the awaiting merge label Mar 21, 2026
@miss-islington-app

miss-islington-app Bot commented Mar 21, 2026

Copy link
Copy Markdown

Thanks @andreuu-tsai for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 21, 2026
@andreuu-tsai @kumaraditya303 @miss-islington
pythongh-138234: clarify returncode behavior for subprocesses created…
f31b87a
… with `shell=True` (pythonGH-138536)

(cherry picked from commit 8a531f8)

Co-authored-by: andreuu-tsai <[email protected]>
Co-authored-by: Kumar Aditya <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 21, 2026
@andreuu-tsai @kumaraditya303 @miss-islington
pythongh-138234: clarify returncode behavior for subprocesses created…
bbaac99
… with `shell=True` (pythonGH-138536)

(cherry picked from commit 8a531f8)

Co-authored-by: andreuu-tsai <[email protected]>
Co-authored-by: Kumar Aditya <[email protected]>
@bedevere-app

bedevere-app Bot commented Mar 21, 2026

Copy link
Copy Markdown

GH-146254 is a backport of this pull request to the 3.14 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Mar 21, 2026
@bedevere-app

bedevere-app Bot commented Mar 21, 2026

Copy link
Copy Markdown

GH-146255 is a backport of this pull request to the 3.13 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Mar 21, 2026
kumaraditya303 added a commit that referenced this pull request Mar 21, 2026
@miss-islington @andreuu-tsai @kumaraditya303
[3.14] gh-138234: clarify returncode behavior for subprocesses create…
f2c7024
…d with `shell=True` (GH-138536) (#146254)

gh-138234: clarify returncode behavior for subprocesses created with `shell=True` (GH-138536)
(cherry picked from commit 8a531f8)

Co-authored-by: andreuu-tsai <[email protected]>
Co-authored-by: Kumar Aditya <[email protected]>
kumaraditya303 added a commit that referenced this pull request Mar 21, 2026
@miss-islington @andreuu-tsai @kumaraditya303
[3.13] gh-138234: clarify returncode behavior for subprocesses create…
29303db
…d with `shell=True` (GH-138536) (#146255)

gh-138234: clarify returncode behavior for subprocesses created with `shell=True` (GH-138536)
(cherry picked from commit 8a531f8)

Co-authored-by: andreuu-tsai <[email protected]>
Co-authored-by: Kumar Aditya <[email protected]>
CuriousLearner added a commit to CuriousLearner/cpython that referenced this pull request Mar 22, 2026
@CuriousLearner
Merge remote-tracking branch 'upstream/main' into fix-pythongh-138577
2691ad9
* upstream/main: (1475 commits)
  Docs: replace all `datetime` imports with `import datetime as dt` (python#145640)
  pythongh-146153: Use `frozendict` in pure python fallback for `curses.has_key` (python#146154)
  pythongh-138234: clarify returncode behavior for subprocesses created with `shell=True` (python#138536)
  pythongh-140947: fix contextvars handling for server tasks in asyncio  (python#141158)
  pythonGH-100108: Add async generators best practices section (python#141885)
  pythonGH-145667: Merge `GET_ITER` and `GET_YIELD_FROM_ITER` (pythonGH-146120)
  pythongh-146228: Better fork support in cached FastPath (python#146231)
  pythongh-146227: Fix wrong type in _Py_atomic_load_uint16 in pyatomic_std.h (pythongh-146229)
  pythongh-145980: Fix copy/paste mistake in binascii.c (python#146230)
  pythongh-146092: Raise MemoryError on allocation failure in _zoneinfo (python#146165)
  pythongh-91279: Note `SOURCE_DATE_EPOCH` support in `ZipFile.writestr()` doc (python#139396)
  pythongh-146196: Fix Undefined Behavior in _PyUnicodeWriter_WriteASCIIString() (python#146201)
  pythongh-143930: Reject leading dashes in webbrowser URLs
  pythongh-145916: Soft-deprecate ctypes.util.find_library (pythonGH-145919)
  pythongh-146205: Check the errno with != 0 in close impls in select module (python#146206)
  pythongh-146171: Fix nested AttributeError suggestions (python#146188)
  pythongh-146099: Optimize _GUARD_CODE_VERSION+IP via function version symbols (pythonGH-146101)
  pythongh-145980: Add support for alternative alphabets in the binascii module (pythonGH-145981)
  pythongh-145754: Update signature retrieval in unittest.mock to use forwardref annotation format (python#145756)
  pythongh-145177: Add emscripten run --test, uses test args from config.toml (python#146160)
  ...
gpshead
gpshead reviewed Mar 22, 2026
View reviewed changes

@gpshead gpshead left a comment

Copy link
Copy Markdown
Member

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.

thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pablogsal pablogsal mentioned this pull request Apr 4, 2026
gh-130273: Fix traceback color output with unicode characters #142529
Merged
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
@andreuu-tsai @kumaraditya303 @ljfp
pythongh-138234: clarify returncode behavior for subprocesses created…
f797cd5
… with `shell=True` (python#138536)

Co-authored-by: Kumar Aditya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gpshead gpshead gpshead left review comments
@kumaraditya303 kumaraditya303 kumaraditya303 approved these changes
@1st1 1st1 Awaiting requested review from 1st1 1st1 is a code owner
@asvetlov asvetlov Awaiting requested review from asvetlov asvetlov is a code owner
@willingc willingc Awaiting requested review from willingc willingc is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

docs Documentation in the Doc dir skip news topic-asyncio

Projects

Docs PRs
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@andreuu-tsai @gpshead @kumaraditya303
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.