-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-45375: Fix assertion failure due to searching for stdlib in unnormalised paths #28735
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only reviewed the C code, but unfortunately I am not acquainted with the semantics of this to understand if they are correct.
That's the problem with all of getpath - nobody is! 😂 At least it's only an alpha right now, and we'll likely work more on it before beta. |
|
@@ -265,7 +265,21 @@ canonicalize(wchar_t *buffer, const wchar_t *path) | |||
return _PyStatus_NO_MEMORY(); | |||
} | |||
|
|||
if (FAILED(PathCchCanonicalizeEx(buffer, MAXPATHLEN + 1, path, 0))) { | |||
if (PathIsRelativeW(path)) { | |||
wchar_t buff[MAXPATHLEN]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allocation should be MAXPATHLEN + 1
. In this file, MAXPATHLEN
refers to the string length of the path, without the terminating null.
Also ensures that when Python is run as part of build, it can locate the library in the source tree even when built out of tree.
https://bugs.python.org/issue45375