Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Update ``Module/getpath.c`` read python zip path if python
version size more than 2 digit.
Comment on lines +1 to +2
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Update ``Module/getpath.c`` read python zip path if python
version size more than 2 digit.
Update ``Module/getpath.c`` to read the stdlib from a zip file when the minor version is more than a single digit.

17 changes: 12 additions & 5 deletions Modules/getpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ calculate_read_pyenv(PyCalculatePath *calculate)
static PyStatus
calculate_zip_path(PyCalculatePath *calculate)
{
const wchar_t *lib_python = L"lib/python00.zip";
const wchar_t *lib_python = L"lib/python000.zip";

if (calculate->prefix_found > 0) {
/* Use the reduced prefix returned by Py_GetPrefix()
Expand All @@ -1307,10 +1307,17 @@ calculate_zip_path(PyCalculatePath *calculate)
return _PyStatus_NO_MEMORY();
}

/* Replace "00" with version */
size_t len = wcslen(calculate->zip_path);
calculate->zip_path[len - 6] = VERSION[0];
calculate->zip_path[len - 5] = VERSION[2];
/* Replace "000" with version */
size_t bufsz = wcslen(calculate->zip_path);
calculate->zip_path[bufsz - 7] = VERSION[0];
calculate->zip_path[bufsz - 6] = VERSION[2];
if (sizeof(VERSION) == 5) {
calculate->zip_path[bufsz - 5] = VERSION[3];
}
else {
memmove(&calculate->zip_path[bufsz - 5],
&calculate->zip_path[bufsz - 4], bufsz);
}

return _PyStatus_OK();
}
Expand Down