Skip to content

Commit fdf2d50

Browse files
committed
Fix test_pyfile_newstdprinter() on WASI
1 parent 5156f46 commit fdf2d50

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Lib/test/test_capi/test_file.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,13 @@ def test_pyfile_newstdprinter(self):
169169

170170
filename = os_helper.TESTFN
171171
self.addCleanup(os_helper.unlink, filename)
172-
old_stdout = os.dup(STDOUT_FD)
172+
173+
try:
174+
old_stdout = os.dup(STDOUT_FD)
175+
except OSError as exc:
176+
# os.dup(STDOUT_FD) is not supported on WASI
177+
self.skipTest(f"os.dup() failed with {exc!r}")
178+
173179
try:
174180
with open(filename, "wb") as fp:
175181
# PyFile_NewStdPrinter() only accepts fileno(stdout)

0 commit comments

Comments
 (0)