Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement PEP 529 for os.getcwdb on Windows #77101

Closed
eryksun opened this issue Feb 23, 2018 · 2 comments
Closed

Implement PEP 529 for os.getcwdb on Windows #77101

eryksun opened this issue Feb 23, 2018 · 2 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes OS-windows stdlib Python modules in the Lib dir topic-unicode type-bug An unexpected behavior, bug, or error

Comments

@eryksun
Copy link
Contributor

eryksun commented Feb 23, 2018

BPO 32920
Nosy @pfmoore, @vstinner, @tjguk, @ezio-melotti, @zware, @eryksun, @zooba, @izbyshev
Superseder
  • bpo-37412: os.getcwdb() doesn't implement PEP 528 (UTF-8) on Windows
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-06-26.14:40:11.977>
    created_at = <Date 2018-02-23.06:44:28.628>
    labels = ['type-bug', '3.8', 'OS-windows', '3.7', 'library', 'expert-unicode']
    title = 'Implement PEP 529 for os.getcwdb on Windows'
    updated_at = <Date 2019-06-26.14:40:11.976>
    user = 'https://github.com/eryksun'

    bugs.python.org fields:

    activity = <Date 2019-06-26.14:40:11.976>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-06-26.14:40:11.977>
    closer = 'vstinner'
    components = ['Library (Lib)', 'Unicode', 'Windows']
    creation = <Date 2018-02-23.06:44:28.628>
    creator = 'eryksun'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32920
    keywords = []
    message_count = 2.0
    messages = ['312620', '346623']
    nosy_count = 8.0
    nosy_names = ['paul.moore', 'vstinner', 'tim.golden', 'ezio.melotti', 'zach.ware', 'eryksun', 'steve.dower', 'izbyshev']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '37412'
    type = 'behavior'
    url = 'https://bugs.python.org/issue32920'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    @eryksun
    Copy link
    Contributor Author

    eryksun commented Feb 23, 2018

    When reviewing bpo-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.

    @eryksun eryksun added 3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir topic-unicode OS-windows type-bug An unexpected behavior, bug, or error labels Feb 23, 2018
    @vstinner
    Copy link
    Member

    I just opened the same issue: bpo-37412, but I proposed a PR to implement my idea ;-)

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes OS-windows stdlib Python modules in the Lib dir topic-unicode type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants