Skip to content

gh-138234: clarify returncode behavior for subprocess_exec vs subprocess_shell#138536

Merged
kumaraditya303 merged 3 commits intopython:mainfrom
andreuu-tsai:doc-asyncio-subprocess-returncode-in-shell
Mar 21, 2026
Merged

gh-138234: clarify returncode behavior for subprocess_exec vs subprocess_shell#138536
kumaraditya303 merged 3 commits intopython:mainfrom
andreuu-tsai:doc-asyncio-subprocess-returncode-in-shell

Conversation

@andreuu-tsai
Copy link
Contributor

@andreuu-tsai andreuu-tsai commented Sep 5, 2025

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).

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

@python-cla-bot
Copy link

python-cla-bot bot commented Sep 5, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

Copy link
Member

@gpshead gpshead left a 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.

Copy link
Contributor

@kumaraditya303 kumaraditya303 left a 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

@bedevere-app
Copy link

bedevere-app bot commented Oct 3, 2025

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.

…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 kumaraditya303 merged commit 8a531f8 into python:main Mar 21, 2026
28 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Mar 21, 2026
@miss-islington-app
Copy link

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!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 21, 2026
… with `shell=True` (pythonGH-138536)

(cherry picked from commit 8a531f8)

Co-authored-by: andreuu-tsai <32549555+andreuu-tsai@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 21, 2026
… with `shell=True` (pythonGH-138536)

(cherry picked from commit 8a531f8)

Co-authored-by: andreuu-tsai <32549555+andreuu-tsai@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
@bedevere-app
Copy link

bedevere-app bot commented Mar 21, 2026

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

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

bedevere-app bot commented Mar 21, 2026

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

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Mar 21, 2026
kumaraditya303 added a commit that referenced this pull request Mar 21, 2026
…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 <32549555+andreuu-tsai@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
kumaraditya303 added a commit that referenced this pull request Mar 21, 2026
…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 <32549555+andreuu-tsai@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
CuriousLearner added a commit to CuriousLearner/cpython that referenced this pull request Mar 22, 2026
* 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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news topic-asyncio

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants