https://github.com/python/cpython/commit/29303db78cc3790962ed90f96095606f74f6af1b
commit: 29303db78cc3790962ed90f96095606f74f6af1b
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2026-03-21T12:38:56Z
summary:

[3.13] gh-138234: clarify returncode behavior for subprocesses created with 
`shell=True` (GH-138536) (#146255)

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

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

files:
M Doc/library/asyncio-subprocess.rst
M Doc/library/subprocess.rst

diff --git a/Doc/library/asyncio-subprocess.rst 
b/Doc/library/asyncio-subprocess.rst
index 7ac9aa724ce0f8..341d8a1b1480ce 100644
--- a/Doc/library/asyncio-subprocess.rst
+++ b/Doc/library/asyncio-subprocess.rst
@@ -311,8 +311,16 @@ their completion.
 
       A ``None`` value indicates that the process has not terminated yet.
 
-      A negative value ``-N`` indicates that the child was terminated
-      by signal ``N`` (POSIX only).
+      For processes created with :func:`~asyncio.create_subprocess_exec`, a 
negative
+      value ``-N`` indicates that the child was terminated by signal ``N``
+      (POSIX only).
+
+      For processes created with :func:`~asyncio.create_subprocess_shell`, the
+      return code reflects the exit status of the shell itself (e.g. 
``/bin/sh``),
+      which may map signals to codes such as ``128+N``. See the
+      documentation of the shell (for example, the Bash manual's Exit Status)
+      for details.
+
 
 
 .. _asyncio-subprocess-threads:
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst
index f6d9a6133fa8c0..4b2a1a9f658601 100644
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -952,6 +952,11 @@ Reassigning them to new values is unsupported:
    A negative value ``-N`` indicates that the child was terminated by signal
    ``N`` (POSIX only).
 
+   When ``shell=True``, the return code reflects the exit status of the shell
+   itself (e.g. ``/bin/sh``), which may map signals to codes such as
+   ``128+N``. See the documentation of the shell (for example, the Bash
+   manual's Exit Status) for details.
+
 
 Windows Popen Helpers
 ---------------------

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to