Feature or enhancement
Proposal:
We could add a special case for the current directory and return it without normalising. This speeds up posixpath.relpath() with one argument.
def abspath(path):
"""Return an absolute path."""
path = os.fspath(path)
if isinstance(path, bytes):
- if not path.startswith(b'/'):- path = join(os.getcwdb(), path)+ sep = b'/'+ curdir = b'.'+ getcwd = os.getcwdb
else:
- if not path.startswith('/'):- path = join(os.getcwd(), path)+ sep = '/'+ curdir = '.'+ getcwd = os.getcwd+ if not path.startswith(sep):+ if not path or path == curdir:+ return getcwd()+ path = join(getcwd(), path)
return normpath(path)Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
Linked PRs
Feature or enhancement
Proposal:
We could add a special case for the current directory and return it without normalising. This speeds up
posixpath.relpath()with one argument.Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
os.path#117610Linked PRs
posixpath.abspath()#117640