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: 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
process
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 2022-04-11 14:58 by admin. 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()
    'C:\\Temp\\Lang\\αβγδ'
    >>> os.getcwdb()
    b'C:\\Temp\\Lang\\a\xdf?d'

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 ;-)
History
Date User Action Args
2022-04-11 14:58:58adminsetgithub: 77101
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