From: Victor Stinner Date: Mon, 7 Sep 2020 14:45:57 +0000 (+0200) Subject: bpo-41401: Fix test_fspath_support in test_io. (GH-21640) (GH-22133) X-Git-Tag: v3.9.0rc2~32 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c73ee5acc96b4bbd6885156883b224b8cc3e470c;p=thirdparty%2FPython%2Fcpython.git 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 67987acd5dc9776f55f4e139e2b3d9e7a6434d9f) Co-authored-by: Serhiy Storchaka --- diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index fe07b56880bb..d2e387728bd5 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -924,7 +924,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())