Title: Implement PEP 529 for os.getcwdb on Windows
Type: behavior Stage: resolved
Components: Library (Lib), Unicode, Windows Versions: Python 3.8, Python 3.7, Python 3.6
Status: closed Resolution: duplicate
Dependencies: Superseder: os.getcwdb() doesn't implement PEP 528 (UTF-8) on Windows
View: 37412
Assigned To: Nosy List: eryksun, ezio.melotti, izbyshev, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Priority: normal Keywords:

Created on 2018-02-23 06:44 by eryksun, last changed 2019-06-26 14:40 by vstinner. This issue is now closed.

Messages (2)
msg312620 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2018-02-23 06:44
When reviewing issue 32904 I noticed that os.getcwdb still calls the CRT _getcwd function. Apparently this was overlooked when implementing PEP 529. For example:

    >>> os.getcwd()
    >>> os.getcwdb()

Not only is the encoding wrong, but because the CRT uses GetFullPathNameA (the CRT's implementation of _getcwd is convoluted, IMO), the call fails if the current directory exceeds MAX_PATH. Python 3.6+ on Windows 10 otherwise supports long paths.
msg346623 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-06-26 14:40
I just opened the same issue: bpo-37412, but I proposed a PR to implement my idea ;-)
Date User Action Args
2019-06-26 14:40:11vstinnersetstatus: open -> closed
superseder: os.getcwdb() doesn't implement PEP 528 (UTF-8) on Windows
messages: + msg346623

resolution: duplicate
stage: needs patch -> resolved
2018-02-23 10:34:02izbyshevsetnosy: + izbyshev
2018-02-23 06:44:28eryksuncreate