-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
gh-120743: Soft deprecate os.popen() function #120744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Soft deprecate os.popen(), os.spawn*() and os.system() functions.
|
cc @gpshead |
|
I don't like |
Doc/library/os.rst
Outdated
| .. 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. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| .. 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
Anything silently using a shell opens the world up for problems that are not obvious to many code authors. Shell injection, quoting hell, spaces, etc. It is fair to say that the world has heard so much about that over the decades that many of us don't even notice that screaming noise anymore. this is just a soft deprecation in the docs to point people towards the well lit path of subprocess.run(). |
If you can recognise the implications of There isn't a case where they behave featurefully different, right? Like, |
|
Is it time to add a new |
|
I removed os.system() deprecation. We can revisit its deprecation once subprocess.shell() will be added or not: #121093 I kept the non-controversial deprecations. |
It seems like a huge maintenance burden to maintain such hypothetical (long) list in the documentation. I don't think that it's worth it, but you can open an issue if you disagree and consider that it's a good idea :-) |
Soft deprecate os.popen() and os.spawn*() functions.
Soft deprecate os.popen() and os.spawn*() functions.
Soft deprecate os.popen() and os.spawn*() functions.
Soft deprecate os.popen(), os.spawn*() and os.system() functions.
📚 Documentation preview 📚: https://cpython-previews--120744.org.readthedocs.build/