Skip to content
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

Use binary file for devnull #271

Merged
merged 3 commits into from
Jul 2, 2021
Merged

Use binary file for devnull #271

merged 3 commits into from
Jul 2, 2021

Conversation

methane
Copy link
Contributor

@methane methane commented Feb 13, 2021

This is not a bug. But binary file is more efficient because TextIOWrapper is not used.

This is not a bug. But binary file is more efficient because TextIOWrapper is not used.
Copy link
Contributor

@hartwork hartwork left a comment

Choose a reason for hiding this comment

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

Seems to work. I have tried:

import os
import subprocess

with open(os.devnull, 'wb') as devnull:
    argv = ['sh', '-c', 'echo stdout; echo stderr >&2']
    subprocess.check_output(argv, stderr=devnull)

@methane
Copy link
Contributor Author

methane commented Jun 16, 2021

We can use stderr=subprocess.DEVNULL isntead of opening it manually if we can drop Python 2 and 3.2 support.

@jdufresne
Copy link
Member

We can use stderr=subprocess.DEVNULL isntead of opening it manually if we can drop Python 2 and 3.2 support.

I opened #281 to remove EOL Pythons, allowing for using DEVULL

jdufresne
jdufresne previously approved these changes Jul 1, 2021
@nir0s nir0s merged commit 53a031d into python-distro:master Jul 2, 2021
@hartwork hartwork added this to the 1.6.0 milestone Jul 10, 2021
@methane methane deleted the patch-1 branch September 18, 2021 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants