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

Oleg Iarygin report at bugs.python.org
Wed Mar 30 09:23:30 EDT 2022


Oleg Iarygin <oleg at arhadthedev.net> 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 changes the whole path so its plain replacement would give a totally wrong one.

Roughly speaking, "//Library/Video" is `/Video` on a computer named `Library`.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47161>
_______________________________________


More information about the Python-bugs-list mailing list