[issue39090] Document various options for getting the absolute path from pathlib.Path objects

2022-04-04 Thread Barney Gale
Barney Gale added the comment: The docs for PurePath.is_absolute() say: > A path is considered absolute if it has both a root and (if the flavour > allows) a drive This does not preclude it from having ".." segments. PurePath.absolute() is documented as of bpo-29688 / 3

[issue47161] pathlib method relative_to doesnt work with // in paths

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

[issue24132] Direct sub-classing of pathlib.Path

2022-03-09 Thread Barney Gale
Barney Gale added the comment: If/when GH-31691 lands, I think this bug can be resolved: the original repro case will no longer raise AttributeError, and subclasses will be able to customize behaviour without needing to define further "flavour" or "access

[issue37609] support "UNC" device paths in ntpath.splitdrive

2022-03-05 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +29822 pull_request: https://github.com/python/cpython/pull/31702 ___ Python tracker <https://bugs.python.org/issue37

[issue37609] support "UNC" device paths in ntpath.splitdrive

2022-03-05 Thread Barney Gale
Barney Gale added the comment: I'd like to pick this up, as it would allow us to remove a duplicate implementation in pathlib with its own shortcomings. If using native functionality if difficult to get right, could I put @eryksun's splitdrive.py implementation up for review

[issue24132] Direct sub-classing of pathlib.Path

2022-03-04 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +29812 pull_request: https://github.com/python/cpython/pull/31691 ___ Python tracker <https://bugs.python.org/issue24

[issue44136] Remove pathlib flavours

2022-03-04 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +29813 pull_request: https://github.com/python/cpython/pull/31691 ___ Python tracker <https://bugs.python.org/issue44

[issue45991] Improve ambiguous docstrings in pkgutil

2022-02-25 Thread Barney Gale
Barney Gale added the comment: Should pkgutil call os.fspath() in this case? -- nosy: +barneygale ___ Python tracker <https://bugs.python.org/issue45

[issue44136] Remove pathlib flavours

2022-02-23 Thread Barney Gale
Barney Gale added the comment: ^ just to bring my previous comment up-to-date: I'm no longer pursuing adding `os.path.isreserved()` and `os.path.fileuri()` functions, or modifying `normpath()`. At least, not for now! Instead, my plan is to move flavour functionality as follows

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-20 Thread Barney Gale
Barney Gale added the comment: Thanks both. I've adjusted PR 31338 to leave is_mount() unchanged. I've opened a new pull request that implements is_mount() on Windows using ntpath.ismount(): PR 31458 -- ___ Python tracker <ht

[issue42777] WindowsPath does not implement is_mount but ntpath implements and offers a ismount method

2022-02-20 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch nosy: +barneygale nosy_count: 1.0 -> 2.0 pull_requests: +29587 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31458 ___ Python tracker <https://bugs.python.org/i

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-15 Thread Barney Gale
Barney Gale added the comment: I'm planning to learn more heavily on posixpath + ntpath in pathlib once bpo-44136 is done. I think that would be a good time to introduce is_mount() support on Windows. -- ___ Python tracker <ht

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-14 Thread Barney Gale
Barney Gale added the comment: Thanks very much Alex. I've added some PRs: PR 31338 addresses owner(), group() and is_mount(). It moves those methods to PosixPath, and adds stubs in WindowsPath that raise deprecation warnings. I agree with your analysis that, for static typing purposes

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-14 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +29491 pull_request: https://github.com/python/cpython/pull/31340 ___ Python tracker <https://bugs.python.org/issue46

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-14 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +29492 pull_request: https://github.com/python/cpython/pull/31341 ___ Python tracker <https://bugs.python.org/issue46

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-14 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +29490 pull_request: https://github.com/python/cpython/pull/31339 ___ Python tracker <https://bugs.python.org/issue46

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-14 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +29489 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31338 ___ Python tracker <https://bugs.python.org/issu

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-12 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +29461 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31085 ___ Python tracker <https://bugs.python.org/issu

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-12 Thread Barney Gale
New submission from Barney Gale : The docs for NotImplementedError say: > In user defined base classes, abstract methods should raise this exception > when they require derived classes to override the method, or while the class > is being developed to indicate that the real imple

[issue46654] urllib.request.urlopen doesn't handle UNC paths produced by pathlib's as_uri() (but can handle UNC paths with additional slashes)

2022-02-05 Thread Barney Gale
Change by Barney Gale : -- title: urllib.request.urlopen doesn't handle UNC paths produced by pathlib's resolve() (but can handle UNC paths with additional slashes) -> urllib.request.urlopen doesn't handle UNC paths produced by pathlib's as_uri() (but can handle UNC pa

[issue46654] urllib.request.urlopen doesn't handle UNC paths produced by pathlib's resolve() (but can handle UNC paths with additional slashes)

2022-02-05 Thread Barney Gale
Barney Gale added the comment: Agree with the previous analysis. Just noting that: >>> nturl2path.pathname2url('host\\share\\test.py') 'host/share/test.py' So four slashes are produced by the urllib code, whereas pathlib only produces two. According to wikipe

[issue46654] file_open doesn't handle UNC paths produced by pathlib's resolve() (but can handle UNC paths with additional slashes)

2022-02-05 Thread Barney Gale
Barney Gale added the comment: urllib uses nturl2path under the hood. On my system it seems to return reasonable results for both two and four leading slashes: >>> nturl2path.url2pathname('host/share/test.py') 'host\\share\\test.py' >>> nturl2path.ur

[issue46654] file_open doesn't handle UNC paths produced by pathlib's resolve() (but can handle UNC paths with additional slashes)

2022-02-05 Thread Barney Gale
Barney Gale added the comment: Why are you adding `.as_uri()`? -- nosy: +barneygale ___ Python tracker <https://bugs.python.org/issue46654> ___ ___ Python-bug

[issue24132] Direct sub-classing of pathlib.Path

2022-02-02 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +29269 pull_request: https://github.com/python/cpython/pull/31085 ___ Python tracker <https://bugs.python.org/issue24

[issue29688] Add support for Path.absolute()

2022-01-31 Thread Barney Gale
Barney Gale added the comment: @eryksun thanks for flagging, a couple thoughts: I'd imagine that bug is reproducible with `Path('C:\\Temp', 'C:')` already, right? If that's the case, should it logged as a separate issue? I'm planning to /experimentally/ throw away pathlib's internal path

[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()

2022-01-30 Thread Barney Gale
Barney Gale added the comment: New users who want to add lines to a file will see this method and do: for line in blah: path.write_text(line, append=True) Which repeatedly opens/closes the file. This is a foot-shotgun; it shouldn't be added to pathlib IMO

[issue29688] Add support for Path.absolute()

2022-01-29 Thread Barney Gale
Barney Gale added the comment: Now that GH 26153 is merged, I think this bug can be resolved. -- ___ Python tracker <https://bugs.python.org/issue29688> ___ ___

[issue46556] pathlib.Path.__enter__() should emit DeprecationWarning

2022-01-27 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +29149 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30971 ___ Python tracker <https://bugs.python.org/issu

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

2022-01-27 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +29150 pull_request: https://github.com/python/cpython/pull/30971 ___ Python tracker <https://bugs.python.org/issue39

[issue46556] pathlib.Path.__enter__() should emit DeprecationWarning

2022-01-27 Thread Barney Gale
New submission from Barney Gale : In Python 3.9 / issue39682 we made Path.__exit__() a no-op, and added a comment in the code mentioning that it should be deprecated in future. The future is here, so let's deprecate it. -- components: Library (Lib) messages: 411936 nosy: barneygale

[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()

2022-01-27 Thread Barney Gale
Barney Gale added the comment: >From https://stackoverflow.com/a/68969892 > I think a major reason why pathlib.Path objects don't (and, indeed, > shouldn't) have a append_text method is because it creates a hole for > inexperienced users to fall into, which is a huge sin i

[issue34526] Path.relative_to() taking multiple arguments could be better documented

2022-01-19 Thread Barney Gale
Change by Barney Gale : -- nosy: +barneygale ___ Python tracker <https://bugs.python.org/issue34526> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43012] Remove pathlib accessors

2022-01-16 Thread Barney Gale
Barney Gale added the comment: Thank you Éric! -- ___ Python tracker <https://bugs.python.org/issue43012> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46317] Pathlib.rename isn't robust

2022-01-15 Thread Barney Gale
Barney Gale added the comment: Fair enough. Users who wanted to avoid copying file metadata would then do something like this, I suppose? import pathlib import shutil path = pathlib.Path('foo') path.move('bar', copy_function=shutil.copy) I guess the downside here

[issue46317] Pathlib.rename isn't robust

2022-01-14 Thread Barney Gale
Barney Gale added the comment: shutil.move() accepts a `copy_function` argument: shutil.move(src, dst, copy_function=copy2) It's possible to set `copy_function=copy` to skip copying file metadata. -- ___ Python tracker <ht

[issue46317] Pathlib.rename isn't robust

2022-01-14 Thread Barney Gale
Barney Gale added the comment: Sounds good. Would you expose the `copy_function` argument in pathlib, or do something else (like `metadata=True`)? -- nosy: +barneygale ___ Python tracker <https://bugs.python.org/issue46

[issue46316] Optimize pathlib.Path.iterdir()

2022-01-09 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +28707 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30501 ___ Python tracker <https://bugs.python.org/issu

[issue46316] Optimize pathlib.Path.iterdir()

2022-01-09 Thread Barney Gale
New submission from Barney Gale : pathlib.Path.iterdir() contains the following code: if name in {'.', '..'}: # Yielding a path object for these makes little sense continue This check is unnecessary as os.listdir() does not return entries for '.' or '..': os.listdir

[issue46148] Optimize pathlib

2022-01-08 Thread Barney Gale
Change by Barney Gale : -- nosy: +barneygale nosy_count: 8.0 -> 9.0 pull_requests: +28697 pull_request: https://github.com/python/cpython/pull/30492 ___ Python tracker <https://bugs.python.org/issu

[issue46227] add pathlib.Path.walk method

2022-01-02 Thread Barney Gale
Change by Barney Gale : -- nosy: +barneygale ___ Python tracker <https://bugs.python.org/issue46227> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45649] Add tarinfo.Path

2022-01-01 Thread Barney Gale
Barney Gale added the comment: If you're only aiming for Traversable compatibility, sure. The original bug description asks for something that's pathlib-compatible and similar to zipfile.Path, which goes beyond the Traversable interface in attempting to emulate pathlib.Path

[issue45649] Add tarinfo.Path

2022-01-01 Thread Barney Gale
Barney Gale added the comment: It's possible to do, but will be a little slow due to the nature of tar files. They're a big linked list of files, so you need to do a bunch of reads/seeks from the start to the end to enumerate all files. I'd ask that we try to get issue24132 solved first

[issue44136] Remove pathlib flavours

2021-12-31 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +28537 pull_request: https://github.com/python/cpython/pull/30321 ___ Python tracker <https://bugs.python.org/issue44

[issue44136] Remove pathlib flavours

2021-12-31 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +28536 pull_request: https://github.com/python/cpython/pull/30320 ___ Python tracker <https://bugs.python.org/issue44

[issue45226] Misleading error message when pathlib.Path.symlink_to() fails with permissions error

2021-09-20 Thread Barney Gale
Barney Gale added the comment: `os.symlink()` and `pathlib.Path.symlink_to()` have reversed argument orders, but in the repro steps you're supplying arguments in the same order. -- nosy: +barneygale ___ Python tracker <https://bugs.python.

[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> ___ ___

[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

[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

[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

[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

[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

[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
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

[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

[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

[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(

[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

[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

[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-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

[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:

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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('**/

[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

[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

[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

[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

[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

[issue43012] Remove pathlib accessors

2021-04-28 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +24391 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25701 ___ Python tracker <https://bugs.python.org/issu

[issue24132] Direct sub-classing of pathlib.Path

2021-04-28 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +24392 pull_request: https://github.com/python/cpython/pull/25701 ___ Python tracker <https://bugs.python.org/issue24

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

2021-04-28 Thread Barney Gale
Barney Gale added the comment: So far I've been keen to keep the Path and AbstractPath APIs the same, but perhaps this case warrants an exception. What if AbstractPath lacked both home() and expanduser(), and those methods only existed on Path? Of all the methods on Path, these two

[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

[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: 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

[issue43936] os.path.realpath() normalizes paths before resolving links on Windows

2021-04-24 Thread Barney Gale
New submission from Barney Gale : Capturing a write-up by eryksun on GitHub into a new bug. Link: https://github.com/python/cpython/pull/25264#pullrequestreview-631787754 > `nt._getfinalpathname()` opens a handle to a file/directory with > `CreateFileW()` and calls `GetFinalPathNameByH

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

2021-04-08 Thread Barney Gale
Barney Gale added the comment: Good spot Eryk - I've put in another PR to address it. -- ___ Python tracker <https://bugs.python.org/issue39899> ___ ___ Pytho

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

2021-04-08 Thread Barney Gale
Barney Gale added the comment: Thanks for the feedback. 1. We can check the return value, like we do in `Path.expanduser()` 2. Seems like expected behaviour? 3. Worth fixing in `ntpath.expanduser()` I think. See Eryk Sun's comment here: https://bugs.python.org/issue39899#msg390507

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

2021-04-08 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +24014 stage: resolved -> patch review pull_request: https://github.com/python/cpython/pull/25277 ___ Python tracker <https://bugs.python.org/issu

[issue930024] os.path.realpath can't handle symlink loops

2021-04-07 Thread Barney Gale
Change by Barney Gale : -- nosy: +barneygale nosy_count: 3.0 -> 4.0 pull_requests: +24006 pull_request: https://github.com/python/cpython/pull/25264 ___ Python tracker <https://bugs.python.org/issue

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

2021-04-07 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch pull_requests: +24004 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25271 ___ Python tracker <https://bugs.python.org/issu

[issue24132] Direct sub-classing of pathlib.Path

2021-04-07 Thread Barney Gale
Change by Barney Gale : -- pull_requests: +24005 pull_request: https://github.com/python/cpython/pull/25271 ___ Python tracker <https://bugs.python.org/issue24

  1   2   >