Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix test_pyfile_newstdprinter() on WASI
  • Loading branch information
vstinner committed Jan 29, 2025
commit fdf2d5053a105d5f16790a0074f92366e68169f9
8 changes: 7 additions & 1 deletion Lib/test/test_capi/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,13 @@ def test_pyfile_newstdprinter(self):

filename = os_helper.TESTFN
self.addCleanup(os_helper.unlink, filename)
old_stdout = os.dup(STDOUT_FD)

try:
old_stdout = os.dup(STDOUT_FD)
except OSError as exc:
# os.dup(STDOUT_FD) is not supported on WASI
self.skipTest(f"os.dup() failed with {exc!r}")

try:
with open(filename, "wb") as fp:
# PyFile_NewStdPrinter() only accepts fileno(stdout)
Expand Down