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
Change by Barney Gale :
--
nosy: +barneygale
___
Python tracker
<https://bugs.python.org/issue47161>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
Change by Barney Gale :
--
pull_requests: +29822
pull_request: https://github.com/python/cpython/pull/31702
___
Python tracker
<https://bugs.python.org/issue37
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
Change by Barney Gale :
--
pull_requests: +29812
pull_request: https://github.com/python/cpython/pull/31691
___
Python tracker
<https://bugs.python.org/issue24
Change by Barney Gale :
--
pull_requests: +29813
pull_request: https://github.com/python/cpython/pull/31691
___
Python tracker
<https://bugs.python.org/issue44
Barney Gale added the comment:
Should pkgutil call os.fspath() in this case?
--
nosy: +barneygale
___
Python tracker
<https://bugs.python.org/issue45
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 follow
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 track
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
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
&
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 pur
Change by Barney Gale :
--
pull_requests: +29491
pull_request: https://github.com/python/cpython/pull/31340
___
Python tracker
<https://bugs.python.org/issue46
Change by Barney Gale :
--
pull_requests: +29492
pull_request: https://github.com/python/cpython/pull/31341
___
Python tracker
<https://bugs.python.org/issue46
Change by Barney Gale :
--
pull_requests: +29490
pull_request: https://github.com/python/cpython/pull/31339
___
Python tracker
<https://bugs.python.org/issue46
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
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
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
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 ca
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.
Acc
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'
>&g
Barney Gale added the comment:
Why are you adding `.as_uri()`?
--
nosy: +barneygale
___
Python tracker
<https://bugs.python.org/issue46654>
___
___
Python-bug
Change by Barney Gale :
--
pull_requests: +29269
pull_request: https://github.com/python/cpython/pull/31085
___
Python tracker
<https://bugs.python.org/issue24
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/
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 pathli
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>
___
___
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
Change by Barney Gale :
--
pull_requests: +29150
pull_request: https://github.com/python/cpython/pull/30971
___
Python tracker
<https://bugs.python.org/issue39
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: barne
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
Change by Barney Gale :
--
nosy: +barneygale
___
Python tracker
<https://bugs.python.org/issue34526>
___
___
Python-bugs-list mailing list
Unsubscribe:
Barney Gale added the comment:
Thank you Éric!
--
___
Python tracker
<https://bugs.python.org/issue43012>
___
___
Python-bugs-list mailing list
Unsubscribe:
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 d
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
&
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
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
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 '.
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
Change by Barney Gale :
--
nosy: +barneygale
___
Python tracker
<https://bugs.python.org/issue46227>
___
___
Python-bugs-list mailing list
Unsubscribe:
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.
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 issue241
Change by Barney Gale :
--
pull_requests: +28537
pull_request: https://github.com/python/cpython/pull/30321
___
Python tracker
<https://bugs.python.org/issue44
Change by Barney Gale :
--
pull_requests: +28536
pull_request: https://github.com/python/cpython/pull/30320
___
Python tracker
<https://bugs.python.org/issue44
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.py
Barney Gale added the comment:
Depends: bpo-39899, bpo-43757, bpo-44316, bpo-44403, bpo-44412
--
___
Python tracker
<https://bugs.python.org/issue44136>
___
___
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
Change by Barney Gale :
--
pull_requests: +25297
pull_request: https://github.com/python/cpython/pull/26708
___
Python tracker
<https://bugs.python.org/issue44
Change by Barney Gale :
--
pull_requests: +25298
pull_request: https://github.com/python/cpython/pull/26708
___
Python tracker
<https://bugs.python.org/issue24
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(
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 ->
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
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
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.o
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
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
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:
>>>
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 tr
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
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
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
Change by Barney Gale :
--
nosy: +barneygale
___
Python tracker
<https://bugs.python.org/issue29249>
___
___
Python-bugs-list mailing list
Unsubscribe:
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 sub
Change by Barney Gale :
--
pull_requests: +24875
pull_request: https://github.com/python/cpython/pull/26270
___
Python tracker
<https://bugs.python.org/issue43
Change by Barney Gale :
--
pull_requests: +24874
pull_request: https://github.com/python/cpython/pull/26270
___
Python tracker
<https://bugs.python.org/issue38
Barney Gale added the comment:
Also requested in #42234.
--
nosy: +barneygale
___
Python tracker
<https://bugs.python.org/issue40358>
___
___
Python-bugs-list m
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
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.o
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
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
Change by Barney Gale :
--
resolution: fixed ->
status: closed -> open
___
Python tracker
<https://bugs.python.org/issue39950>
___
___
Python-bugs-list
Change by Barney Gale :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Barney Gale :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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
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
Change by Barney Gale :
--
pull_requests: +24778
pull_request: https://github.com/python/cpython/pull/26141
___
Python tracker
<https://bugs.python.org/issue24
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
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
Change by Barney Gale :
--
type: -> performance
versions: +Python 3.11
___
Python tracker
<https://bugs.python.org/issue43012>
___
___
Python-bugs-list mai
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
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
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
Change by Barney Gale :
--
pull_requests: +24729
pull_request: https://github.com/python/cpython/pull/26090
___
Python tracker
<https://bugs.python.org/issue43
Change by Barney Gale :
--
pull_requests: +24728
pull_request: https://github.com/python/cpython/pull/26089
___
Python tracker
<https://bugs.python.org/issue39
Change by Barney Gale :
--
pull_requests: +24727
pull_request: https://github.com/python/cpython/pull/26088
___
Python tracker
<https://bugs.python.org/issue43
Change by Barney Gale :
--
pull_requests: +24726
pull_request: https://github.com/python/cpython/pull/26087
___
Python tracker
<https://bugs.python.org/issue39
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 `o
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
Change by Barney Gale :
--
pull_requests: +24392
pull_request: https://github.com/python/cpython/pull/25701
___
Python tracker
<https://bugs.python.org/issue24
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 ar
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 fo
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
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 fo
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
Barney Gale added the comment:
Good spot Eryk - I've put in another PR to address it.
--
___
Python tracker
<https://bugs.python.org/issue39899>
___
___
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#msg3
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
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
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
Change by Barney Gale :
--
pull_requests: +24005
pull_request: https://github.com/python/cpython/pull/25271
___
Python tracker
<https://bugs.python.org/issue24
1 - 100 of 162 matches
Mail list logo