Skip to content

Commit c73ee5a

Browse files
bpo-41401: Fix test_fspath_support in test_io. (GH-21640) (GH-22133)
The error is exposed on non-UTF-8 locales. (cherry picked from commit 67987ac) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent b6d2acb commit c73ee5a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/test/test_io.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ def check_path_succeeds(path):
924924
self.assertEqual(f.read(), "egg\n")
925925

926926
check_path_succeeds(FakePath(support.TESTFN))
927-
check_path_succeeds(FakePath(support.TESTFN.encode('utf-8')))
927+
check_path_succeeds(FakePath(os.fsencode(support.TESTFN)))
928928

929929
with self.open(support.TESTFN, "w") as f:
930930
bad_path = FakePath(f.fileno())

0 commit comments

Comments
 (0)