Skip to content

Commit bcc7959

Browse files
committed
Use lower-level os.open() instead of open()
1 parent 397eac5 commit bcc7959

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sounddevice.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2827,8 +2827,8 @@ def _initialize():
28272827
old_stderr = 2 # To appease Pyright
28282828
try:
28292829
old_stderr = _os.dup(2)
2830-
devnull = open(_os.devnull, 'w')
2831-
_os.dup2(devnull.fileno(), 2)
2830+
devnull = _os.open(_os.devnull, _os.O_WRONLY)
2831+
_os.dup2(devnull, 2)
28322832
except OSError:
28332833
pass
28342834
try:
@@ -2838,7 +2838,7 @@ def _initialize():
28382838
finally:
28392839
if devnull is not None:
28402840
_os.dup2(old_stderr, 2)
2841-
devnull.close()
2841+
_os.close(devnull)
28422842

28432843

28442844
def _terminate():

0 commit comments

Comments
 (0)