[issue37412] os.getcwdb() doesn't implement PEP 528 (UTF-8) on Windows

Eryk Sun report at bugs.python.org
Wed Jun 26 21:10:01 EDT 2019


Eryk Sun <eryksun at gmail.com> added the comment:

This update breaks long-path support in Windows. It includes the following unnecessary check, which is using the wrong comparison operator:

        if (len >= PY_SSIZE_T_MAX / sizeof(wchar_t))

PyMem_RawMalloc already checks this and returns NULL if size > (size_t)PY_SSIZE_T_MAX. This bug is causing a MemoryError with long paths:

    >>> p = 'C:/Temp/longpath' + ('/' + 'a' * 255) * 9
    >>> os.chdir(p)
    >>> len(os.getcwd())
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    MemoryError

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37412>
_______________________________________


More information about the Python-bugs-list mailing list