Skip to content

Conversation

@barneygale
Copy link
Contributor

In PathBase.resolve(), raise UnsupportedOperation if a non-POSIX path parser is used (our implementation uses posixpath._realpath(), which produces incorrect results for non-POSIX paths.) Also tweak code to call self.absolute() upfront rather than supplying an emulated getcwd() function.

Adjust PathBase.absolute() to work somewhat like resolve(). If a POSIX path parser is used, we treat the root directory as the current directory. This is the simplest useful behaviour for concrete path types without a current directory cursor.

No user-facing changes because the pathlib ABCs are still private, and pathlib.Path overrides both these methods.

In `PathBase.resolve()`, raise `UnsupportedOperation` if a non-POSIX path
parser is used (our implementation uses `posixpath._realpath()`, which
produces incorrect results for non-POSIX path flavours.) Also tweak code to
call `self.absolute()` upfront rather than supplying an emulated `getcwd()`
function.

Adjust `PathBase.absolute()` to work somewhat like `resolve()`. If a POSIX
path parser is used, we treat the root directory as the current directory.
This is the simplest useful behaviour for concrete path types without a
current directory cursor.
@barneygale barneygale enabled auto-merge (squash) November 9, 2024 18:22
@barneygale barneygale merged commit 2663285 into python:main Nov 9, 2024
34 checks passed
picnixz pushed a commit to picnixz/cpython that referenced this pull request Dec 8, 2024
In `PathBase.resolve()`, raise `UnsupportedOperation` if a non-POSIX path
parser is used (our implementation uses `posixpath._realpath()`, which
produces incorrect results for non-POSIX path flavours.) Also tweak code to
call `self.absolute()` upfront rather than supplying an emulated `getcwd()`
function.

Adjust `PathBase.absolute()` to work somewhat like `resolve()`. If a POSIX
path parser is used, we treat the root directory as the current directory.
This is the simplest useful behaviour for concrete path types without a
current directory cursor.
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
In `PathBase.resolve()`, raise `UnsupportedOperation` if a non-POSIX path
parser is used (our implementation uses `posixpath._realpath()`, which
produces incorrect results for non-POSIX path flavours.) Also tweak code to
call `self.absolute()` upfront rather than supplying an emulated `getcwd()`
function.

Adjust `PathBase.absolute()` to work somewhat like `resolve()`. If a POSIX
path parser is used, we treat the root directory as the current directory.
This is the simplest useful behaviour for concrete path types without a
current directory cursor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant