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

gh-94526: getpath_dirname() no longer encodes the path #97645

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Sep 29, 2022

  1. pythongh-94526: getpath_dirname() no longer encodes the path

    Fix the Python path configuration used to initialized sys.path at
    Python startup. Paths are no longer encoded to UTF-8/strict to avoid
    encoding errors if it contains surrogate characters (bytes paths are
    decoded with the surrogateescape error handler).
    
    getpath_basename() and getpath_dirname() functions no longer encode
    the path to UTF-8/strict, but work directly on Unicode strings. These
    functions now use PyUnicode_FindChar() and PyUnicode_Substring() on
    the Unicode path, rather than strrchr() on the encoded bytes string.
    vstinner committed Sep 29, 2022