bpo-46015: Fixes calculation of sys.path in a venv on Windows (GH-29992)

Also ensures that pybuilddir.txt is written early enough in the build to be picked up by later steps.
This commit is contained in:
Steve Dower 2021-12-08 19:25:58 +00:00 committed by GitHub
parent 3cb9731b7e
commit 7778116c2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 12 deletions

View file

@ -390,7 +390,7 @@ getpath_readlines(PyObject *Py_UNUSED(self), PyObject *args)
while (cb && (p1[cb] == L'\n' || p1[cb] == L'\r')) {
--cb;
}
PyObject *u = PyUnicode_FromWideChar(p1, cb + 1);
PyObject *u = PyUnicode_FromWideChar(p1, cb ? cb + 1 : 0);
if (!u || PyList_Append(r, u) < 0) {
Py_XDECREF(u);
Py_CLEAR(r);