[issue39783] Optimize construction of Path from other Paths by just returning the same object?

2020-02-28 Thread Barney Gale
Barney Gale added the comment: Attempted fix shown here: https://github.com/barneygale/cpython/commit/784630ef6ad05031abdefa523e61e0629b15e201 Note that I've already removed context manager support (and hence `_closed`) in this branch. -- nosy: +barneygale

[issue39682] pathlib.Path objects can be used as context managers

2020-03-03 Thread Barney Gale
Barney Gale added the comment: Also, thank you Antoine for your explanation :-) -- ___ Python tracker <https://bugs.python.org/issue39682> ___ ___ Python-bug

[issue39682] pathlib.Path objects can be used as context managers

2020-03-03 Thread Barney Gale
Barney Gale added the comment: Can I ask what sort of backwards-compatibility guarantees Python provides for these cases? In the case of using a Path object as a context manager, I think we can say: - It's easy to do - there's no need to call any underscore-prefixed methods for example

[issue39659] pathlib calls `os.getcwd()` without using accessor

2020-02-17 Thread Barney Gale
Barney Gale added the comment: 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 a

[issue39682] pathlib.Path objects can be used as context managers

2020-02-18 Thread Barney Gale
New submission from Barney Gale : `pathlib.Path` objects can be used as context managers, but this functionality is undocumented and makes little sense. Example: >>> import pathlib >>> root = pathlib.Path("/") >>> with root: ... print(1)

[issue39659] pathlib calls `os.getcwd()` without using accessor

2020-02-16 Thread Barney Gale
New submission from Barney Gale : 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

[issue39906] pathlib.Path: add `follow_symlinks` argument to `stat()` and `chmod()`

2020-03-08 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +18221 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18864 ___ Python tracker <https://bugs.python.org/issu

[issue7479] os.lchmod is not present

2020-03-08 Thread Barney Gale
Change by Barney Gale : -- nosy: +barneygale nosy_count: 5.0 -> 6.0 pull_requests: +18222 pull_request: https://github.com/python/cpython/pull/18864 ___ Python tracker <https://bugs.python.org/iss

[issue39907] `pathlib.Path.iterdir()` wastes memory by using `os.listdir()` rather than `os.scandir()`

2020-03-08 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +18223 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18865 ___ Python tracker <https://bugs.python.org/issu

[issue39907] `pathlib.Path.iterdir()` wastes memory by using `os.listdir()` rather than `os.scandir()`

2020-03-08 Thread Barney Gale
New submission from Barney Gale : `pathlib.Path.iterdir()` uses `os.listdir()` rather than `os.scandir()`. I think this has a small performance cost, per PEP 471: > It returns a generator instead of a list, so that scandir acts as a true > iterator instead of returning the ful

[issue39906] pathlib.Path: add `follow_symlinks` argument to `stat()` and `chmod()`

2020-03-08 Thread Barney Gale
New submission from Barney Gale : As of Python 3.3, `os.lstat()` and `os.lchmod()` are available as `os.stat(follow_symlinks=False)` and `os.chmod(follow_symlinks=False)`, but an equivalent change didn't make it into pathlib. I propose we add the `follow_symlinks` argument to `Path.stat

[issue39907] `pathlib.Path.iterdir()` wastes memory by using `os.listdir()` rather than `os.scandir()`

2020-03-09 Thread Barney Gale
Barney Gale added the comment: Less reliable how? Doesn't appear any slower: barney.gale@heilbron:~$ python3 -m timeit -s "import os; os.listdir('/usr/local')" 1 loops, best of 3: 0.0108 usec per loop barney.gale@heilbron:~$ python3 -m timeit -s "import os; list(o

[issue39907] `pathlib.Path.iterdir()` wastes memory by using `os.listdir()` rather than `os.scandir()`

2020-03-09 Thread Barney Gale
Barney Gale added the comment: Ah, right you are! The globbing helpers call `list(os.scandir(...))` - perhaps we should do the same here? -- ___ Python tracker <https://bugs.python.org/issue39

[issue39924] pathlib handles missing `os.link`, `os.symlink` and `os.readlink` inconsistently

2020-03-12 Thread Barney Gale
Barney Gale added the comment: Good points! Do you know of an example of a community library that uses `_Accessor.link`? Thanks -- ___ Python tracker <https://bugs.python.org/issue39

[issue39950] Add pathlib.Path.hardlink_to()

2020-03-12 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +18321 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18909 ___ Python tracker <https://bugs.python.org/issu

[issue39950] Add pathlib.Path.hardlink_to()

2020-03-12 Thread Barney Gale
New submission from Barney Gale : Per bpo-39291, the argument order for `pathlib.Path.link_to()` is inconsistent with `symlink_to()` and its own documentation. This ticket covers adding a new `hardlink_to()` method with the correct argument order, and deprecating `link_to()`. Discussion

[issue39291] "pathlib.Path.link_to()" and "pathlib.Path.symlink_to()" have reversed usage

2020-03-12 Thread Barney Gale
Barney Gale added the comment: Per discussion on the mailing list, I'd like to request that this bug be re-opened. https://mail.python.org/archives/list/python-...@python.org/thread/7QPLYW36ZK6QTW4SV4FI6C343KYWCPAT/ -- nosy: +barneygale

[issue39925] `pathlib.Path.link_to()` has the wrong argument order

2020-03-10 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +18264 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18909 ___ Python tracker <https://bugs.python.org/issu

[issue40038] pathlib: remove partial support for preserving accessor when modifying a path

2020-04-03 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +18706 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19342 ___ Python tracker <https://bugs.python.org/issu

[issue39950] Add pathlib.Path.hardlink_to()

2020-03-29 Thread Barney Gale
Barney Gale added the comment: A question: For my patch, I need to include a Python version where `Path.link_to()` will become unavailable. I'm not entirely sure how this should be determined. Some factors in play: - `link_to()` was added in Python 3.8 - On github, I found these three

[issue24132] Direct sub-classing of pathlib.Path

2020-03-29 Thread Barney Gale
Barney Gale added the comment: I'm taking another look at making `pathlib` extensible. There's some discussion here: https://discuss.python.org/t/make-pathlib-extensible/3428 List or preparatory bugfixes and tidy-ups: https://docs.google.com/spreadsheets/d

[issue40107] pathlib: make `_Accessor.open()` return a file object and not a file descriptor

2020-03-29 Thread Barney Gale
New submission from Barney Gale : This is one of a series of bug reports / PRs that lay the groundwork for making pathlib extensible. See here for detail: https://discuss.python.org/t/make-pathlib-extensible/3428 Currently `_Accessor.open()` is expected to function like `os.open

[issue39924] pathlib handles missing `os.link`, `os.symlink` and `os.readlink` inconsistently

2020-03-29 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +18582 pull_request: https://github.com/python/cpython/pull/19220 ___ Python tracker <https://bugs.python.org/issue39

[issue40038] pathlib: remove partial support for preserving accessor when modifying a path

2020-03-21 Thread Barney Gale
New submission from Barney Gale : `pathlib.Path._init()` accepts a 'template' argument that pathlib uses - in some cases - to preserve the current accessor object when creating modified path objects. This works for `resolve()`, `absolute()` and `readlink()`, *but no other cases

[issue39659] pathlib calls `os.getcwd()` without using accessor

2020-03-07 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +18191 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18834 ___ Python tracker <https://bugs.python.org/issu

[issue39894] `pathlib.Path.samefile()` calls `os.stat()` without using accessor

2020-03-07 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +18193 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18836 ___ Python tracker <https://bugs.python.org/issu

[issue39894] `pathlib.Path.samefile()` calls `os.stat()` without using accessor

2020-03-07 Thread Barney Gale
New submission from Barney Gale : `Path.samefile()` calls `os.stat()` directly. It should use the path's accessor object, as `Path.stat()` does. -- components: Library (Lib) messages: 363629 nosy: barneygale priority: normal severity: normal status: open title: `pathlib.Path.samefile

[issue39895] `pathlib.Path.touch()` calls `os.close()` without using accessor

2020-03-07 Thread Barney Gale
New submission from Barney Gale : `Path.touch()` does a lot of os-specific /stuff/ that should probably live in the accessor. Perhaps most importantly, is calls `os.close()` on whatever `accessor.open()` returns, which is problematic for those wishing to write their own accessor that doesn't

[issue39899] `pathlib.Path.expanduser()` does not call `os.path.expanduser()`

2020-03-07 Thread Barney Gale
New submission from Barney Gale : `pathlib.Path.expanduser()` does not call `os.path.expanduser()`, but instead re-implements it. The implementations look pretty similar and I can't see a good reason for the duplication. The only difference is that `pathlib.Path.expanduser()` raises

[issue39895] `pathlib.Path.touch()` calls `os.close()` without using accessor

2020-03-07 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +18195 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18838 ___ Python tracker <https://bugs.python.org/issu

[issue39897] `pathlib.Path.is_mount()` calls `Path(self.parent)` and therefore misbehaves in `Path` subclasses

2020-03-07 Thread Barney Gale
New submission from Barney Gale : `pathlib.Path.is_mount()` calls `Path(self.parent)`, which: - Is needless, as `self.parent` is already a Path instance! - Prevents effective subclassing, as `self.parent` may be a `Path` subclass with its own `stat()` implementation -- components

[issue39897] `pathlib.Path.is_mount()` calls `Path(self.parent)` and therefore misbehaves in `Path` subclasses

2020-03-07 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +18196 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18839 ___ Python tracker <https://bugs.python.org/issu

[issue39900] `pathlib.Path.__bytes__()` calls `os.fsencode()` without using accessor

2020-03-10 Thread Barney Gale
Barney Gale added the comment: Closing after @pitrou clarified the meaning of __fspath__() here: https://discuss.python.org/t/make-pathlib-extensible/3428/12?u=barneygale -- resolution: -> not a bug stage: patch review -> resolved status: open -&g

[issue39907] `pathlib.Path.iterdir()` wastes memory by using `os.listdir()` rather than `os.scandir()`

2020-03-09 Thread Barney Gale
Change by Barney Gale : -- resolution: -> not a bug stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue39907] `pathlib.Path.iterdir()` wastes memory by using `os.listdir()` rather than `os.scandir()`

2020-03-09 Thread Barney Gale
Barney Gale added the comment: Thanks Rémi and Serhiy! Closing this ticket as the patch doesn't provide any sort of improvement. -- ___ Python tracker <https://bugs.python.org/issue39

[issue39901] `pathlib.Path.owner()` and `group()` use `pwd` and `grp` modules directly

2020-03-08 Thread Barney Gale
New submission from Barney Gale : The implementations of `Path.owner()` and `Path.group()` directly import and use the `pwd` and `grp` modules. Given these modules provide information about the *local* system, I believe these implementations should instead live in `pathlib._NormalAccessor

[issue39901] `pathlib.Path.owner()` and `group()` use `pwd` and `grp` modules directly

2020-03-08 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +18201 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18844 ___ Python tracker <https://bugs.python.org/issu

[issue39899] `pathlib.Path.expanduser()` does not call `os.path.expanduser()`

2020-03-08 Thread Barney Gale
Barney Gale added the comment: I see no reason for the duplication, and I can point to one concrete bug affecting your re-implementation of `expanduser` that doesn't affect the original, i.e. that a `KeyError` is raised on Windows when `"USERNAME"` is not present in `os.environ

[issue39682] pathlib.Path objects can be used as context managers

2020-03-08 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +18203 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18846 ___ Python tracker <https://bugs.python.org/issu

[issue39925] `pathlib.Path.link_to()` has the wrong argument order

2020-03-10 Thread Barney Gale
New submission from Barney Gale : `mylink.symlink_to(target)` and `mylink.link_to(target)` should both create a link (soft or hard) at *mylink* that points to *target*. But `link_to()` does the opposite - it creates *target* and points it towards *mylink*. Correct behaviour from `symlink_to

[issue39924] pathlib handles missing `os.link`, `os.symlink` and `os.readlink` inconsistently

2020-03-10 Thread Barney Gale
New submission from Barney Gale : Small bug report encompassing some related issues in `pathlib._NormalAccessor`: - `link_to()` should be named `link()` for consistency with other methods - `symlink()` doesn't need to guard against `os.symlink()` not accepting `target_is_directory` on non

[issue39925] `pathlib.Path.link_to()` has the wrong argument order

2020-03-10 Thread Barney Gale
Barney Gale added the comment: I'm not sure how it can be fixed on the documentation side - it's difficult to explain that `a.link_to(b)` creates a link from B to A, and not vice-versa. We could introduce a new method that does the right thing? `Path.hardlink_to

[issue39900] `pathlib.Path.__bytes__()` calls `os.fsencode()` without using accessor

2020-03-07 Thread Barney Gale
New submission from Barney Gale : `pathlib.Path.__bytes__()` calls `os.fsencode()` without using path's accessor. To properly isolate Path objects from the underlying local filesystem, this should be routed via the accessor object. -- messages: 363638 nosy: barneygale priority

[issue39900] `pathlib.Path.__bytes__()` calls `os.fsencode()` without using accessor

2020-03-07 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +18199 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18842 ___ Python tracker <https://bugs.python.org/issu

[issue39899] `pathlib.Path.expanduser()` does not call `os.path.expanduser()`

2020-03-07 Thread Barney Gale
Barney Gale added the comment: We can check whether `os.path.expanduser()` returned a path beginning with "~" and raise a RuntimeError if so, right? On point #2, I'm not sure this optimization alone justifies the duplication. P

[issue39899] `pathlib.Path.expanduser()` does not call `os.path.expanduser()`

2020-03-07 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +18198 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18841 ___ Python tracker <https://bugs.python.org/issu

[issue39899] `pathlib.Path.expanduser()` does not call `os.path.expanduser()`

2020-03-08 Thread Barney Gale
Barney Gale added the comment: The only design flaw mentioned in that thread is that `os.path.expanduser()` returns the input unchanged if expansion fails, which is not very pythonic. However, such a problem doesn't necessitate a rewrite of `os.path.expanduser()`. Checking `result[:1

[issue42999] `pathlib.Path.link_to()` documentation is misleading

2021-01-21 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +23116 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18909 ___ Python tracker <https://bugs.python.org/issu

[issue42998] pathlib.Path: add `username` argument to `home()`

2021-01-21 Thread Barney Gale
New submission from Barney Gale : The `pathlib.Path.home()` function looks like: @classmethod def home(cls): """Return a new path pointing to the user's home directory (as returned by os.path.expanduser('~')). """ return

[issue39950] Add pathlib.Path.hardlink_to()

2021-01-21 Thread Barney Gale
Barney Gale added the comment: Makes sense to me. Should I leave the documentation for `link_to` completely alone? With the addition of a similar function, I wonder if that may in itself cause confusion. -- ___ Python tracker <ht

[issue42998] pathlib.Path: add `username` argument to `home()`

2021-01-21 Thread Barney Gale
Barney Gale added the comment: I should add that this is part of a plan to spin out some `Path` methods into a new `UserPath` class. Notably, in this case, `UserPath.expanduser()` will call `self.home()` under-the-hood. This is done to reduce the surface area of abstract methods

[issue42999] `pathlib.Path.link_to()` documentation is misleading

2021-01-21 Thread Barney Gale
New submission from Barney Gale : Compare the documentation of `symlink_to()` and `link_to()`: .. method:: Path.symlink_to(target, target_is_directory=False) Make this path a symbolic link to *target*. .. method:: Path.link_to(target) Create a hard link pointing to a path named

[issue39950] Add pathlib.Path.hardlink_to()

2021-01-21 Thread Barney Gale
Barney Gale added the comment: I've logged bpo-42999 to cover fixing the existing `link_to()` docs issues. PR incoming... -- ___ Python tracker <https://bugs.python.org/issue39

[issue42999] `pathlib.Path.link_to()` documentation is misleading

2021-01-21 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +23117 pull_request: https://github.com/python/cpython/pull/24294 ___ Python tracker <https://bugs.python.org/issue42

[issue43012] Remove pathlib accessors

2021-01-23 Thread Barney Gale
New submission from Barney Gale : Per Pitrou: > The original intent for the “accessor” thing was to have a variant that did > all accesses under a filesystem tree in a race condition-free way using > openat and friends. It turned out to be much too hairy to actually impleme

[issue44316] Support preserving path meaning in os.path.normpath() and abspath()

2021-06-12 Thread Barney Gale
Barney Gale added the comment: For this bug specifically, the pathlib docs describe the desirable behaviour: Spurious slashes and single dots are collapsed, but double dots ('..') are not, since this would change the meaning of a path in the face of symbolic links: >>> PurePath(

[issue29688] Add support for Path.absolute()

2021-06-12 Thread Barney Gale
Barney Gale added the comment: Hi - please could a core dev review PR 26153? It adds documentation and tests for Path.absolute(). Thank you! -- ___ Python tracker <https://bugs.python.org/issue29

[issue44316] Support preserving path meaning in os.path.normpath() and abspath()

2021-06-12 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +25279 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26694 ___ Python tracker <https://bugs.python.org/issu

[issue44316] Support preserving path meaning in os.path.normpath() and abspath()

2021-06-12 Thread Barney Gale
Barney Gale added the comment: Thanks Terry, I've added a topic here: https://discuss.python.org/t/pathlib-and-os-path-code-duplication-and-feature-parity/9239 The bit about `normpath()` is towards the middle of the post. -- ___ Python tracker

[issue44403] Add os.path.isreserved() function

2021-06-12 Thread Barney Gale
New submission from Barney Gale : Windows reserves certain filenames like 'NUL'. Checking for these names is part of a small handful of functionality that is available in pathlib but not in os.path. I propose that we add an os.path.isreserved() function, encorporating Eryk Sun's work on bpo

[issue27827] pathlib is_reserved fails for some reserved paths on Windows

2021-06-12 Thread Barney Gale
Barney Gale added the comment: I've put Eryk's patch up as a PR: https://github.com/python/cpython/pull/26698 -- ___ Python tracker <https://bugs.python.org/issue27

[issue44316] Support preserving path meaning in os.path.normpath() and abspath()

2021-06-12 Thread Barney Gale
Barney Gale added the comment: I think I agree How would you feel about two new arguments? Following `os.curdir` and `os.pardir` names: def normpath(path, *, keep_curdir=False, keep_pardir=False) ... -- ___ Python tracker <ht

[issue27827] pathlib is_reserved fails for some reserved paths on Windows

2021-06-12 Thread Barney Gale
Change by Barney Gale : -- nosy: +barneygale nosy_count: 6.0 -> 7.0 pull_requests: +25283 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26698 ___ Python tracker <https://bugs.python.org/i

[issue39950] Add pathlib.Path.hardlink_to()

2021-06-13 Thread Barney Gale
Change by Barney Gale : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.10 -Python 3.9 ___ Python tracker <https://bugs.python.or

[issue44136] Remove pathlib flavours

2021-06-13 Thread Barney Gale
Barney Gale added the comment: Depends: bpo-39899, bpo-43757, bpo-44316, bpo-44403, bpo-44412 -- ___ Python tracker <https://bugs.python.org/issue44136> ___ ___

[issue24132] Direct sub-classing of pathlib.Path

2021-06-13 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +25298 pull_request: https://github.com/python/cpython/pull/26708 ___ Python tracker <https://bugs.python.org/issue24

[issue44136] Remove pathlib flavours

2021-06-13 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +25297 pull_request: https://github.com/python/cpython/pull/26708 ___ Python tracker <https://bugs.python.org/issue44

[issue44412] Add os.path.fileuri() function

2021-06-13 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +25296 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26708 ___ Python tracker <https://bugs.python.org/issu

[issue44412] Add os.path.fileuri() function

2021-06-13 Thread Barney Gale
New submission from Barney Gale : Proposal: - Introduce `os.path.fileuri()` function that produces a 'file://' URI - Adjust `PurePosixPath.to_uri()` to call `posixpath.fileuri()` - Adjust `PureWindowsPath.to_uri()` to call `ntpath.fileuri()` - Adjust `nturl2path.pathname2url()` to call

[issue42998] pathlib.Path: add `username` argument to `home()`

2021-06-13 Thread Barney Gale
Barney Gale added the comment: Per discussion, expanduser('~other') is considered unreliable, and we shouldn't add new functions that call through to it. Resolving as 'rejected'. -- resolution: -> rejected stage: patch review -> resolved status: open -&g

[issue43012] Remove pathlib accessors

2021-05-13 Thread Barney Gale
Change by Barney Gale : -- type: -> performance versions: +Python 3.11 ___ Python tracker <https://bugs.python.org/issue43012> ___ ___ Python-bugs-list mai

[issue38671] pathlib.Path.resolve(strict=False) returns relative path on Windows if the entry does not exist

2021-05-16 Thread Barney Gale
Change by Barney Gale : -- nosy: +barneygale nosy_count: 8.0 -> 9.0 pull_requests: +24802 pull_request: https://github.com/python/cpython/pull/26184 ___ Python tracker <https://bugs.python.org/issu

[issue42234] pathlib relative_to behaviour change

2021-05-16 Thread Barney Gale
Barney Gale added the comment: That does sound pretty useful! I'd be happy to review a PR though I'm not a core dev. -- nosy: +barneygale ___ Python tracker <https://bugs.python.org/issue42

[issue42234] pathlib relative_to behaviour change

2021-05-16 Thread Barney Gale
Barney Gale added the comment: In fact, I think this is a duplicate of issue40358, which has an open PR against it. -- ___ Python tracker <https://bugs.python.org/issue42

[issue40358] pathlib's relative_to should behave like os.path.relpath

2021-05-16 Thread Barney Gale
Barney Gale added the comment: Also requested in #42234. -- nosy: +barneygale ___ Python tracker <https://bugs.python.org/issue40358> ___ ___ Python-bugs-list m

[issue24132] Direct sub-classing of pathlib.Path

2021-05-15 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +24778 pull_request: https://github.com/python/cpython/pull/26141 ___ Python tracker <https://bugs.python.org/issue24

[issue44136] Remove pathlib flavours

2021-05-15 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +24776 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26141 ___ Python tracker <https://bugs.python.org/issu

[issue29688] Add support for Path.absolute()

2021-05-15 Thread Barney Gale
Barney Gale 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

[issue39950] Add pathlib.Path.hardlink_to()

2021-05-15 Thread Barney Gale
Change by Barney Gale : -- resolution: fixed -> status: closed -> open ___ Python tracker <https://bugs.python.org/issue39950> ___ ___ Python-bugs-list

[issue39950] Add pathlib.Path.hardlink_to()

2021-05-15 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +24789 stage: resolved -> patch review pull_request: https://github.com/python/cpython/pull/26155 ___ Python tracker <https://bugs.python.org/issu

[issue29688] Add support for Path.absolute()

2021-05-15 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch nosy: +barneygale nosy_count: 8.0 -> 9.0 pull_requests: +24787 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26153 ___ Python tracker <https://bugs.python.org/i

[issue39924] pathlib handles missing `os.link`, `os.symlink` and `os.readlink` inconsistently

2021-05-15 Thread Barney Gale
Change by Barney Gale : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue39950] Add pathlib.Path.hardlink_to()

2021-05-15 Thread Barney Gale
Change by Barney Gale : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue26032] Use scandir() to speed up pathlib globbing

2021-05-12 Thread Barney Gale
Change by Barney Gale : -- nosy: +barneygale nosy_count: 8.0 -> 9.0 pull_requests: +24730 pull_request: https://github.com/python/cpython/pull/25701 ___ Python tracker <https://bugs.python.org/issu

[issue39906] pathlib.Path: add `follow_symlinks` argument to `stat()` and `chmod()`

2021-05-12 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +24726 pull_request: https://github.com/python/cpython/pull/26087 ___ Python tracker <https://bugs.python.org/issue39

[issue43757] pathlib: move 'resolve()' logic out of path flavour

2021-05-12 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +24727 pull_request: https://github.com/python/cpython/pull/26088 ___ Python tracker <https://bugs.python.org/issue43

[issue43757] pathlib: move 'resolve()' logic out of path flavour

2021-05-12 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +24729 pull_request: https://github.com/python/cpython/pull/26090 ___ Python tracker <https://bugs.python.org/issue43

[issue39906] pathlib.Path: add `follow_symlinks` argument to `stat()` and `chmod()`

2021-05-12 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +24728 pull_request: https://github.com/python/cpython/pull/26089 ___ Python tracker <https://bugs.python.org/issue39

[issue44119] Use glob.glob() to implement pathlib.Path.glob()

2021-05-13 Thread Barney Gale
Barney Gale added the comment: Flawed implementation, timings were bogus. Closing in shame. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue44119] Use glob.glob() to implement pathlib.Path.glob()

2021-05-12 Thread Barney Gale
New submission from Barney Gale : I have a scratchy patch that replaces pathlib's globbing implementation with glob.glob(), which gained a `root_dir` argument in bpo-38144 Encouraging timings: $ ./python -m timeit -s "from pathlib import Path; p = Path()" -- "list(p.glob('**/

[issue44136] Remove pathlib flavours

2021-05-14 Thread Barney Gale
New submission from Barney Gale : Following bpo-39899, bpo-43757 and bpo-43012, `pathlib._Flavour` and its subclasses are looking a bit pointless. The implementations of `is_reserved()` and `make_uri()` (~`as_uri()`) can be readily moved to into `PurePosixPath` and `PureWindowsPath`, which

[issue38671] pathlib.Path.resolve(strict=False) returns relative path on Windows if the entry does not exist

2021-05-20 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +24874 pull_request: https://github.com/python/cpython/pull/26270 ___ Python tracker <https://bugs.python.org/issue38

[issue43757] pathlib: move 'resolve()' logic out of path flavour

2021-05-20 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +24875 pull_request: https://github.com/python/cpython/pull/26270 ___ Python tracker <https://bugs.python.org/issue43

[issue29249] Pathlib glob ** bug

2021-06-04 Thread Barney Gale
Change by Barney Gale : -- nosy: +barneygale ___ Python tracker <https://bugs.python.org/issue29249> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44316] Support preserving path meaning in os.path.normpath() and abspath()

2021-06-04 Thread Barney Gale
New submission from Barney Gale : >>> os.path.normpath('a/./b/../c//.') 'a/c' >>> pathlib.Path('a/./b/../c//.') PosixPath('a/b/../c') pathlib takes care not to change the meaning of the path when normalising. That means preserving '..' entries, as these can't be simplified

[issue44198] Add flags or function in pathlib.Path

2021-05-21 Thread Barney Gale
Barney Gale added the comment: My view: I think the existing solution (that you highlight) is sufficiently idiomatic and easy to discover, and doesn't warrant a new argument or function. However, that may change when `Path` is subclassable, for two reasons: 1. You will be able to subclass

[issue42998] pathlib.Path: add `username` argument to `home()`

2021-04-26 Thread Barney Gale
Barney Gale added the comment: Thanks very much for taking a look. I can understand the view that, given the unreliability of `os.path.expanduser('~foo')`, we shouldn't be making that functionality *more* available. My argument for this being a reasonable change is as follows: Firstly

[issue42998] pathlib.Path: add `username` argument to `home()`

2021-04-26 Thread Barney Gale
Barney Gale added the comment: In the previous comment, I was referring to bpo-39899 when I referred to "my patch". Long day! :D -- ___ Python tracker <https://bugs.python.o

[issue42998] pathlib.Path: add `username` argument to `home()`

2021-04-26 Thread Barney Gale
Barney Gale added the comment: Totally valid! I suppose it hinges on the relatively likelihood/unlikelihood of us being able to make `expanduser('~foo')` reliable in future. On this question I'm relieved to defer to the experts! @eryksun: penny for your thoughts

[issue24132] Direct sub-classing of pathlib.Path

2021-05-02 Thread Barney Gale
Barney Gale added the comment: Progress report: I've been working on tidying up the pathlib internals over the 3.9 and 3.10 releases. We're now in a position where: - `pathlib._Flavour` is entirely pure, and doesn't make any `os` calls - `pathlib._Accessor` handles all `os` access

  1   2   >