Skip to content

Commit

Permalink
Wrap paths in PurePosixPath to ensure that any WindowsPaths don't get…
Browse files Browse the repository at this point in the history
… backslashes.
  • Loading branch information
jaraco committed Aug 2, 2024
1 parent 2e6a69e commit 90cbfbe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion distutils/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import functools
import importlib.util
import os
import pathlib
import re
import string
import subprocess
Expand Down Expand Up @@ -130,7 +131,9 @@ def convert_path(pathname: str | os.PathLike) -> str:
>>> convert_path(None) is None
True
"""
return make_native(os.fspath(pathname))
# wrap in PurePosixPath to retain forward slashes on Windows
# see https://github.com/pypa/distutils/pull/272#issuecomment-2240100013
return make_native(os.fspath(pathlib.PurePosixPath(pathname)))


def make_native(pathname: str) -> str:
Expand Down

0 comments on commit 90cbfbe

Please sign in to comment.