summaryrefslogtreecommitdiffstats
path: root/Lib/pathlib.py
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2022-01-28 23:40:55 (GMT)
committerGitHub <noreply@github.com>2022-01-28 23:40:55 (GMT)
commit18cb2ef46c9998480f7182048435bc58265c88f2 (patch)
tree6a57bd91442c285bc4580d7ce66f7457a653cc78 /Lib/pathlib.py
parent1f036ede59e2c4befc07714cf76603c591d5c972 (diff)
downloadcpython-18cb2ef46c9998480f7182048435bc58265c88f2.zip
cpython-18cb2ef46c9998480f7182048435bc58265c88f2.tar.gz
cpython-18cb2ef46c9998480f7182048435bc58265c88f2.tar.bz2
bpo-29688: document and test `pathlib.Path.absolute()` (GH-26153)
Co-authored-by: Brett Cannon <brett@python.org> Co-authored-by: Brian Helba <brian.helba@kitware.com>
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r--Lib/pathlib.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index d42ee4d..1603325 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -1043,24 +1043,19 @@ class Path(PurePath):
yield p
def absolute(self):
- """Return an absolute version of this path. This function works
- even if the path doesn't point to anything.
+ """Return an absolute version of this path by prepending the current
+ working directory. No normalization or symlink resolution is performed.
- No normalization is done, i.e. all '.' and '..' will be kept along.
Use resolve() to get the canonical path to a file.
"""
- # XXX untested yet!
if self.is_absolute():
return self
- # FIXME this must defer to the specific flavour (and, under Windows,
- # use nt._getfullpathname())
return self._from_parts([self._accessor.getcwd()] + self._parts)
def resolve(self, strict=False):
"""
Make the path absolute, resolving all symlinks on the way and also
- normalizing it (for example turning slashes into backslashes under
- Windows).
+ normalizing it.
"""
def check_eloop(e):