Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-120743: Soft deprecate os.popen() function
Soft deprecate os.popen(), os.spawn*() and os.system() functions.
  • Loading branch information
vstinner committed Jun 19, 2024
commit 916a28cd9a229db708542ec878a2e924bc351f14
14 changes: 13 additions & 1 deletion Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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=(), \
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Comment thread
vstinner marked this conversation as resolved.
to using this function. See the :ref:`subprocess-replacements` section in
the :mod:`subprocess` documentation for some helpful recipes.

Expand All @@ -4984,6 +4992,10 @@ written in Python, such as a mail server's external command delivery program.

.. availability:: Unix, Windows, not WASI, not iOS.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. 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.

I don't like this one


.. function:: times()

Expand Down
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ Deprecated
as a single positional argument.
(Contributed by Serhiy Storchaka in :gh:`109218`.)

* :term:`Soft deprecate <soft deprecated>` :func:`os.popen`,
:func:`os.spawn* <os.spawnl>` and :func:`os.system` 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
=======
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:term:`Soft deprecate <soft deprecated>` :func:`os.popen`, :func:`os.spawn*
<os.spawnl>` and :func:`os.system` functions. They should no longer be used to
write new code. The :mod:`subprocess` module is recommended instead. Patch by
Victor Stinner.