diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index bea4342e7f0..8eef332b8e4 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -922,7 +922,7 @@ class IOTest(unittest.TestCase): self.assertEqual(f.read(), "egg\n") check_path_succeeds(FakePath(support.TESTFN)) - check_path_succeeds(FakePath(support.TESTFN.encode('utf-8'))) + check_path_succeeds(FakePath(os.fsencode(support.TESTFN))) with self.open(support.TESTFN, "w") as f: bad_path = FakePath(f.fileno())