gh-118263: Add additional arguments to path_t (Argument Clinic type) in posixmodule (GH-119608)

This commit is contained in:
Nice Zombies 2024-05-28 12:13:01 +02:00 committed by GitHub
parent ab9b605efa
commit 09a85eaa4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 317 additions and 270 deletions

View file

@ -521,7 +521,7 @@ def expandvars(path):
# Previously, this function also truncated pathnames to 8+3 format,
# but as this module is called "ntpath", that's obviously wrong!
try:
from nt import _path_normpath
from nt import _path_normpath as normpath
except ImportError:
def normpath(path):
@ -560,14 +560,6 @@ except ImportError:
comps.append(curdir)
return prefix + sep.join(comps)
else:
def normpath(path):
"""Normalize path, eliminating double slashes, etc."""
path = os.fspath(path)
if isinstance(path, bytes):
return os.fsencode(_path_normpath(os.fsdecode(path))) or b"."
return _path_normpath(path) or "."
def _abspath_fallback(path):
"""Return the absolute version of a path as a fallback function in case