This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Incosistency in pathlib between / and \
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pitrou Nosy List: pitrou, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2015-01-02 09:40 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pathlib_parse_parts_altsep.patch serhiy.storchaka, 2015-02-12 21:36 review
Messages (6)
msg233308 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-01-02 09:40
>>> pathlib.PureWindowsPath('c:/a/b', '/x/y')
PureWindowsPath('c:/x/y')
>>> pathlib.PureWindowsPath('//?/c:/a/b', '/x/y')
PureWindowsPath('/x/y')
>>> pathlib.PureWindowsPath(r'\\?\c:\a\b', '/x/y')
PureWindowsPath('//?/c:/x/y')

I suppose this is because in parse_parts() altsep is replaced with sep before calling self.splitroot() in main loop but not in other loop (if drv or root). Line 76.
msg235826 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-02-12 14:23
Ping.
msg235851 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2015-02-12 19:21
Yes, this is a bug indeed. A patch would be welcome ;-)
msg235855 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-02-12 21:36
Here is a patch. It also fixes tests which didn't test altsep.
msg236048 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-02-15 17:07
New changeset 0f8f24dab34b by Antoine Pitrou in branch '3.4':
Issue #23146: Fix mishandling of absolute Windows paths with forward slashes in pathlib.
https://hg.python.org/cpython/rev/0f8f24dab34b

New changeset 0de45993c21c by Antoine Pitrou in branch 'default':
Issue #23146: Fix mishandling of absolute Windows paths with forward slashes in pathlib.
https://hg.python.org/cpython/rev/0de45993c21c
msg236049 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2015-02-15 17:07
Thanks for the patch!
History
Date User Action Args
2022-04-11 14:58:11adminsetgithub: 67335
2015-02-15 17:07:32pitrousetstatus: open -> closed
resolution: fixed
messages: + msg236049

stage: patch review -> resolved
2015-02-15 17:07:14python-devsetnosy: + python-dev
messages: + msg236048
2015-02-15 13:00:00serhiy.storchakasetassignee: pitrou
2015-02-12 21:36:44serhiy.storchakasetfiles: + pathlib_parse_parts_altsep.patch
keywords: + patch
messages: + msg235855

stage: needs patch -> patch review
2015-02-12 19:21:54pitrousetmessages: + msg235851
2015-02-12 14:23:42serhiy.storchakasetmessages: + msg235826
2015-01-02 09:40:25serhiy.storchakacreate