Skip to content

Commit 42ea99b

Browse files
vstinnerAkasurde
authored andcommitted
pythongh-120743: Soft deprecate os.popen() function (python#120744)
Soft deprecate os.popen() and os.spawn*() functions.
1 parent fa8fc30 commit 42ea99b

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

Doc/library/os.rst

+9-1
Original file line numberDiff line numberDiff line change
@@ -4642,6 +4642,10 @@ written in Python, such as a mail server's external command delivery program.
46424642
Use :class:`subprocess.Popen` or :func:`subprocess.run` to
46434643
control options like encodings.
46444644

4645+
.. deprecated:: 3.14
4646+
The function is :term:`soft deprecated` and should no longer be used to
4647+
write new code. The :mod:`subprocess` module is recommended instead.
4648+
46454649

46464650
.. function:: posix_spawn(path, argv, env, *, file_actions=None, \
46474651
setpgroup=None, resetids=False, setsid=False, setsigmask=(), \
@@ -4868,6 +4872,10 @@ written in Python, such as a mail server's external command delivery program.
48684872
.. versionchanged:: 3.6
48694873
Accepts a :term:`path-like object`.
48704874

4875+
.. deprecated:: 3.14
4876+
These functions are :term:`soft deprecated` and should no longer be used
4877+
to write new code. The :mod:`subprocess` module is recommended instead.
4878+
48714879

48724880
.. data:: P_NOWAIT
48734881
P_NOWAITO
@@ -4972,7 +4980,7 @@ written in Python, such as a mail server's external command delivery program.
49724980
shell documentation.
49734981

49744982
The :mod:`subprocess` module provides more powerful facilities for spawning
4975-
new processes and retrieving their results; using that module is preferable
4983+
new processes and retrieving their results; using that module is recommended
49764984
to using this function. See the :ref:`subprocess-replacements` section in
49774985
the :mod:`subprocess` documentation for some helpful recipes.
49784986

Doc/whatsnew/3.14.rst

+5
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ Deprecated
144144
as a single positional argument.
145145
(Contributed by Serhiy Storchaka in :gh:`109218`.)
146146

147+
* :term:`Soft deprecate <soft deprecated>` :func:`os.popen` and
148+
:func:`os.spawn* <os.spawnl>` functions. They should no longer be used to
149+
write new code. The :mod:`subprocess` module is recommended instead.
150+
(Contributed by Victor Stinner in :gh:`120743`.)
151+
147152

148153
Removed
149154
=======
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:term:`Soft deprecate <soft deprecated>` :func:`os.popen` and :func:`os.spawn*
2+
<os.spawnl>` functions. They should no longer be used to write new code. The
3+
:mod:`subprocess` module is recommended instead. Patch by Victor Stinner.

0 commit comments

Comments
 (0)