classification
Title: pathlib calls `os.getcwd()` without using accessor
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: barneygale, eamanu, pitrou, steve.dower
Priority: normal Keywords: patch

Created on 2020-02-17 00:57 by barneygale, last changed 2021-04-07 18:32 by steve.dower. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18834 merged barneygale, 2020-03-08 02:30
Messages (4)
msg362114 - (view) Author: Barney Gale (barneygale) * Date: 2020-02-17 00:57
Whereas most calls to `os` functions from `pathlib.Path` methods happen via `pathlib._Accessor` methods, retrieving the current working directory does not. This problem occurs when calling the `pathlib.Path.cwd()`, `~resolve()` and `~absolute()` methods.
msg362138 - (view) Author: Emmanuel Arias (eamanu) * Date: 2020-02-17 12:05
Sorry, I cannot catch what is the problem of not use _Accesor on PurePath class
msg362157 - (view) Author: Barney Gale (barneygale) * Date: 2020-02-17 21:41
Those methods are non-pure, i.e. part of `Path` but not `PurePath`. Only impure paths have accessors. The `_Accessor` docstring says: "an accessor implements a particular (system-specific or not) way of accessing paths on the filesystem". This abstraction is pretty pointless if covers `os.readlink()` but not `os.getcwd()`!
msg390446 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-04-07 16:31
New changeset b05440c52b9814dbd47f679d47367e87855bd7b5 by Barney Gale in branch 'master':
bpo-39659: Route calls from pathlib.Path to os.getcwd() via the path accessor (GH-18834)
https://github.com/python/cpython/commit/b05440c52b9814dbd47f679d47367e87855bd7b5
History
Date User Action Args
2021-04-07 18:32:57steve.dowersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-04-07 16:31:56steve.dowersetnosy: + steve.dower
messages: + msg390446
2020-03-09 12:04:39xtreaksetnosy: + pitrou
2020-03-08 02:30:01barneygalesetkeywords: + patch
stage: patch review
pull_requests: + pull_request18191
2020-02-17 21:41:00barneygalesetmessages: + msg362157
2020-02-17 12:05:30eamanusetnosy: + eamanu
messages: + msg362138
2020-02-17 00:57:41barneygalecreate