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: os seperator error. str method of PureWindowsPath on Ming64 env
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.8
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: demirbey, eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2021-07-30 13:41 by demirbey, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg398548 - (view) Author: mert (demirbey) Date: 2021-07-30 13:41
PureWindowsPath('C:\\Users')

When I call __str__ method of PureWindowsPath on Windows,Cygwin,Linux enviroment, I get "C:\Users" as expected. But when I run the same code on MingW environment I get "C:/Users". 

from pathlib import PureWindowsPath, Path

p = PureWindowsPath('C:\\Users')

print(str(p))
msg398558 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2021-07-30 15:27
MinGW Python sets os.sep to "/" and os.altsep to "\\". It also swaps _WindowsFlavour.sep and _WindowsFlavour.altsep in pathlib. This seems dubious to me. Technically the Windows API supports both backslash and slash as path separators, but in practice many API functions only support backslash (e.g. the path functions such as PathCchSkipRoot). Anyway, it's a third-party issue. You'll have to report it to the MinGW maintainers if you want it resolved, or to at least get an informed reason why the change is necessary.
History
Date User Action Args
2022-04-11 14:59:48adminsetgithub: 88941
2021-07-30 15:27:41eryksunsetstatus: open -> closed

type: behavior
components: + Windows

nosy: + paul.moore, tim.golden, eryksun, zach.ware, steve.dower
messages: + msg398558
resolution: third party
stage: resolved
2021-07-30 13:41:30demirbeycreate