[issue29688] Add support for Path.absolute()

Barney Gale report at bugs.python.org
Sat May 15 18:19:38 EDT 2021


Barney Gale <barney.gale at gmail.com> added the comment:

New PR up here: https://github.com/python/cpython/pull/26153

The correspondence between `pathlib` and `os.path` is as follows:


- `Path.resolve()` is roughly `os.path.realpath()`
- `Path.absolute()` is roughly `os.path.abspath()`

Differences:

- `resolve()` always raises RuntimeError on symlink loops, whereas `realpath()` either raises OSError or nothing depending on *strict*.
- `absolute()` doesn't normalize the path, whereas `abspath()` does. Normalizing without resolving symlinks can change the meaning of the path, so pathlib does the better thing here.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue29688>
_______________________________________


More information about the Python-bugs-list mailing list