uv
2ca39f1a - Skip root when assessing prefix viability (#9823)

Commit
1 year ago
Skip root when assessing prefix viability (#9823) ## Summary In CPython, it appears that `/` is not considered as a valid path in `search_up`: ```c static PyObject * getpath_dirname(PyObject *Py_UNUSED(self), PyObject *args) { PyObject *path; if (!PyArg_ParseTuple(args, "U", &path)) { return NULL; } Py_ssize_t end = PyUnicode_GET_LENGTH(path); Py_ssize_t pos = PyUnicode_FindChar(path, SEP, 0, end, -1); if (pos < 0) { return PyUnicode_FromStringAndSize(NULL, 0); } return PyUnicode_Substring(path, 0, pos); } ``` ```python def search_up(prefix, *landmarks, test=isfile): while prefix: if any(test(joinpath(prefix, f)) for f in landmarks): return prefix prefix = dirname(prefix) ``` Closes https://github.com/astral-sh/uv/issues/9818.
Author
Parents
Loading