Open
Description
Bug report
pathlib's Path.relative_to() and os.path.relpath(), the two have different behavior: On Linux os.path.relpath() understands double-slash in path is same as single slash, but Path.relative_to() does not.
For example,
import os
os.path.relpath('//foo/bar', '/foo') # results 'bar'
from pathlib import Path
pathlib.PosixPath('//foo/bar').relative_to('/foo') # raises ValueError
pytest issue pytest-dev/pytest#9894 relates to this.
Your environment
- CPython versions tested on: 3.9.2
- Operating system and architecture: Debian Bullseye