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

2022-04-01 Thread Barney Gale
Change by Barney Gale : -- nosy: +barneygale ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2022-04-01 Thread Eryk Sun
Eryk Sun added the comment: > Hmm..., I get it, but Im not gonna lie it's pretty confusing given > that in other places `//` works as a substitute for `/`. Maybe it > should be mentioned in the documentation? In Linux, the system resolves "//" as just "/". In other POSIX systems, such as

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

2022-03-30 Thread Oleg Iarygin
Change by Oleg Iarygin : -- keywords: +patch pull_requests: +30271 stage: -> patch review pull_request: https://github.com/python/cpython/pull/32193 ___ Python tracker ___

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

2022-03-30 Thread Jan Bronicki
Jan Bronicki added the comment: Hmm..., I get it, but Im not gonna lie it's pretty confusing given that in other places `//` works as a substitute for `/`. Maybe it should be mentioned in the documentation? -- ___ Python tracker

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

2022-03-30 Thread Oleg Iarygin
Oleg Iarygin added the comment: > But shouldn't it just work with `//` as a `/`? It seems like this is the > behavior elsewhere. It works elsewhere because empty directory names are impossible so can be dropped. But if `//` is placed in the beginning, it gets a special meaning that totally

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

2022-03-30 Thread Jan Bronicki
Jan Bronicki added the comment: But shouldn't it just work with `//` as a `/`? It seems like this is the behavior elsewhere. Sure I get that it cannot be done for 3.8. But the new error message implies that either `//` is not a subpath of `/` which it is, or that one is relative and the

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

2022-03-30 Thread Oleg Iarygin
Oleg Iarygin added the comment: Also, the error message cannot be fixed because for 3.8 only security fixes are accepted since May 2021. For 3.9 and later, the message is already corrected. -- ___ Python tracker

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

2022-03-30 Thread Oleg Iarygin
Oleg Iarygin added the comment: As I found out, any path starting with two double slashes is treated as an UNC (network) path: root \\machine\mountpoint\directory\etc\... directory ^ So "/Library/Video" and "/" are directories

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

2022-03-30 Thread Oleg Iarygin
Oleg Iarygin added the comment: I started to investigate and found that a double slash in the beginning cancels any parsing of a path: >>> Path("//Library/Video")._parts ['Library\\Video\\'] vs >>> Path("/Library/Video")._parts ['\\', 'Library', 'Video'] Investigating

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

2022-03-30 Thread Jan Bronicki
New submission from Jan Bronicki : The `//` path should be equivalent to `/`, and in some ways, it does behave like that in pathlib. But in the `relative_to` method on a `Path` object, it does not work This is causing our CI pipeline to fail. In the documentation here you can see `//` being