-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-91954: Emit EncodingWarning from locale and subprocess #91977
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
locale.getpreferredencoding() and subprocess.Popen() emit EncodingWarning
I think this may have caused the following failure on recent Windows ARM64 buildbots:
|
I opened #92090 and ran buildbots to find out what the output is:
|
def test_encoding_warning(self): | ||
code = textwrap.dedent("""\ | ||
from subprocess import * | ||
args = ["echo", "hello"] |
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.
Notice how the majority of the tests in this file use a child process of [sys.executable, "-c", "print('hello')"]
to avoid the platform problems. Depending on a shell command working across platforms always causes future problems. See also the above test which simply skips windows because it relies on sleep 3 instead of using the above idiom. ;)
I'm not going to suggest yet another followup PR as if things are stable, lets just let it be. But the modern idiom in test_subprocess is to not launch things other than sys.executable based processes to avoid depending upon the external execution environment.
Fix: #91954