]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41401: Fix test_fspath_support in test_io. (GH-21640)
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 27 Jul 2020 17:58:35 +0000 (20:58 +0300)
committerGitHub <noreply@github.com>
Mon, 27 Jul 2020 17:58:35 +0000 (20:58 +0300)
The error is exposed on non-UTF-8 locales.

Lib/test/test_io.py

index 18b8a7941668fff64ec87adad54781a4b15865a9..85fac30e300a659cff924cddae46c4f8469f8398 100644 (file)
@@ -928,7 +928,7 @@ class IOTest(unittest.TestCase):
                 self.assertEqual(f.read(), "egg\n")
 
         check_path_succeeds(FakePath(os_helper.TESTFN))
-        check_path_succeeds(FakePath(os_helper.TESTFN.encode('utf-8')))
+        check_path_succeeds(FakePath(os.fsencode(os_helper.TESTFN)))
 
         with self.open(os_helper.TESTFN, "w") as f:
             bad_path = FakePath(f.fileno())