Skip to content

Commit 680f3e2

Browse files
authored
Merge pull request #10327 from AA-Turner/devnul
Use an explicit encoding when opening `os.devnul`
2 parents ed5d4e1 + 594413e commit 680f3e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/_pytest/capture.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def __init__(self, targetfd: int) -> None:
381381
self.targetfd_save = os.dup(targetfd)
382382

383383
if targetfd == 0:
384-
self.tmpfile = open(os.devnull)
384+
self.tmpfile = open(os.devnull, encoding="utf-8")
385385
self.syscapture = SysCapture(targetfd)
386386
else:
387387
self.tmpfile = EncodedFile(

0 commit comments

Comments
 (0)