Skip to content

gh-87901: Add encoding to os.popen #92374

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

Merged
merged 2 commits into from
May 6, 2022
Merged

Conversation

methane
Copy link
Member

@methane methane commented May 6, 2022

Fix #87901

@methane methane added stdlib Python modules in the Lib dir and removed awaiting core review labels May 6, 2022
@methane methane merged commit 2b563f1 into python:main May 6, 2022
@methane methane deleted the os-popen-encoding branch May 6, 2022 05:48
JelleZijlstra added a commit to python/typeshed that referenced this pull request May 7, 2022
if not isinstance(cmd, str):
raise TypeError("invalid cmd type (%s, expected string)" % type(cmd))
if mode not in ("r", "w"):
raise ValueError("invalid mode %r" % mode)
if buffering == 0 or buffering is None:
raise ValueError("popen() does not support unbuffered streams")
import subprocess, io
encoding = io.text_encoding(encoding)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I'm missing something obvious, but shouldn't this be passed to subprocess.Popen?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you. I was too rushed.
I will fix it in follow up PR.
#92415

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PEP 597: os.popen() uses locale encoding
3 participants