gh-106242: Fix path truncation in os.path.normpath (GH-106816)

This commit is contained in:
Finn Womack 2023-08-15 08:33:00 -07:00 committed by GitHub
parent 607f18c894
commit 0932272431
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 9 deletions

View file

@ -460,6 +460,10 @@ class CommonTest(GenericTest):
for path in ('', '.', '/', '\\', '///foo/.//bar//'):
self.assertIsInstance(self.pathmodule.normpath(path), str)
def test_normpath_issue106242(self):
for path in ('\x00', 'foo\x00bar', '\x00\x00', '\x00foo', 'foo\x00'):
self.assertEqual(self.pathmodule.normpath(path), path)
def test_abspath_issue3426(self):
# Check that abspath returns unicode when the arg is unicode
# with both ASCII and non-ASCII cwds.