bpo-46049: Fixes ._pth support on non-Windows (GH-30051)

This commit is contained in:
Steve Dower
2021-12-11 15:06:17 +00:00
committed by GitHub
parent 971ece8e17
commit bfc59ed0a0
4 changed files with 52 additions and 41 deletions

View File

@@ -141,7 +141,7 @@ getpath_hassuffix(PyObject *Py_UNUSED(self), PyObject *args)
if (path) {
suffix = PyUnicode_AsWideCharString(suffixobj, &suffixLen);
if (suffix) {
if (suffixLen < len ||
if (suffixLen > len ||
#ifdef MS_WINDOWS
wcsicmp(&path[len - suffixLen], suffix) != 0
#else