https://github.com/python/cpython/commit/d44c550f7ebee7d33785142e6031a4621cf21573
commit: d44c550f7ebee7d33785142e6031a4621cf21573
branch: main
author: Victor Stinner <vstin...@python.org>
committer: vstinner <vstin...@python.org>
date: 2024-07-01T18:27:50+02:00
summary:

gh-120743: Soft deprecate os.popen() function (#120744)

Soft deprecate os.popen() and os.spawn*() functions.

files:
A Misc/NEWS.d/next/Library/2024-06-19-15-43-04.gh-issue-120743.CMMl2P.rst
M Doc/library/os.rst
M Doc/whatsnew/3.14.rst

diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 360d71e70960c7..8d95d01fe55ed9 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -4642,6 +4642,10 @@ written in Python, such as a mail server's external 
command delivery program.
       Use :class:`subprocess.Popen` or :func:`subprocess.run` to
       control options like encodings.
 
+   .. deprecated:: 3.14
+      The function is :term:`soft deprecated` and should no longer be used to
+      write new code. The :mod:`subprocess` module is recommended instead.
+
 
 .. function:: posix_spawn(path, argv, env, *, file_actions=None, \
                           setpgroup=None, resetids=False, setsid=False, 
setsigmask=(), \
@@ -4868,6 +4872,10 @@ written in Python, such as a mail server's external 
command delivery program.
    .. versionchanged:: 3.6
       Accepts a :term:`path-like object`.
 
+   .. deprecated:: 3.14
+      These functions are :term:`soft deprecated` and should no longer be used
+      to write new code. The :mod:`subprocess` module is recommended instead.
+
 
 .. data:: P_NOWAIT
           P_NOWAITO
@@ -4972,7 +4980,7 @@ written in Python, such as a mail server's external 
command delivery program.
    shell documentation.
 
    The :mod:`subprocess` module provides more powerful facilities for spawning
-   new processes and retrieving their results; using that module is preferable
+   new processes and retrieving their results; using that module is recommended
    to using this function.  See the :ref:`subprocess-replacements` section in
    the :mod:`subprocess` documentation for some helpful recipes.
 
diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst
index ee3001661b3143..6ebadd75092fac 100644
--- a/Doc/whatsnew/3.14.rst
+++ b/Doc/whatsnew/3.14.rst
@@ -144,6 +144,11 @@ Deprecated
   as a single positional argument.
   (Contributed by Serhiy Storchaka in :gh:`109218`.)
 
+* :term:`Soft deprecate <soft deprecated>` :func:`os.popen` and
+  :func:`os.spawn* <os.spawnl>` functions. They should no longer be used to
+  write new code.  The :mod:`subprocess` module is recommended instead.
+  (Contributed by Victor Stinner in :gh:`120743`.)
+
 
 Removed
 =======
diff --git 
a/Misc/NEWS.d/next/Library/2024-06-19-15-43-04.gh-issue-120743.CMMl2P.rst 
b/Misc/NEWS.d/next/Library/2024-06-19-15-43-04.gh-issue-120743.CMMl2P.rst
new file mode 100644
index 00000000000000..e06dcf8af26a60
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-06-19-15-43-04.gh-issue-120743.CMMl2P.rst
@@ -0,0 +1,3 @@
+:term:`Soft deprecate <soft deprecated>` :func:`os.popen` and :func:`os.spawn*
+<os.spawnl>` functions. They should no longer be used to write new code. The
+:mod:`subprocess` module is recommended instead. Patch by Victor Stinner.

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to