FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-37616: Fix incorrect zip path for 3.10 prep by nsiregar · Pull Request #14874 · python/cpython · GitHub

Repository navigation

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

Filter by extension

Filter by extension .c  (1) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL