This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Windows assertion in out-of-tree debug build
Type: Stage: resolved
Components: Windows Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: steve.dower Nosy List: eryksun, pablogsal, paul.moore, steve.dower, tim.golden, zach.ware
Priority: high Keywords: patch

Created on 2021-10-05 11:38 by steve.dower, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 28735 merged steve.dower, 2021-10-05 12:06
PR 28764 merged steve.dower, 2021-10-06 16:00
Messages (6)
msg403229 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-10-05 11:38
As seen in the release build for 3.11a1, an assertion is raised when attempting to launch the debug build out of tree.

       _RegenTestFrozenmain:
         Regenerate test_frozenmain.h
         D:\a\1\b\bin\amd64\python_d.exe Programs\freeze_test_frozenmain.py Programs/test_frozenmain.h
         Assertion failed: stdlibdir[wcslen(prefix)] == SEP, file D:\a\1\s\PC\getpathp.c, line 300

This causes the release to fail.
msg403230 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-10-05 11:43
I believe this is because getpath has hit its final fallback case of looking in ".\DLLs" and ".\Lib" for the standard library, and has not performed proper normalisation on these paths. So after removing the last segment, the result is "." which does not end in SEP.

So at least in this case, we can probably just ignore the assertion. However, I'm concerned that this would open up other cases where search paths may be added that are otherwise unintended.

The expected behaviour when the stdlib can't be found is a detailed error message, not a debug assertion/crash.
msg403236 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-10-05 12:37
New changeset 5146877623ebe8a2806411703b0de9c0aba179a1 by Steve Dower in branch 'main':
bpo-45375: Fix assertion failure due to searching for stdlib in unnormalised paths (GH-28735)
https://github.com/python/cpython/commit/5146877623ebe8a2806411703b0de9c0aba179a1
msg403304 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2021-10-06 14:26
I left a message on the PR a day ago about a one-off error in the allocation of `buff`. The size should be `MAXPATHLEN + 1`. That's what's used everywhere else in PC/getpathp.c and what gets passed in the PathCchCombineEx(buff, MAXPATHLEN + 1, ...) call.
msg403322 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-10-06 16:03
Thanks for mentioning it! New PR to fix
msg403333 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-10-06 19:09
New changeset 6c942a86a4fb4c8b731cb1bd2933dba554eb79cd by Steve Dower in branch 'main':
bpo-45375: Fix off by one error in buffer allocation (GH-28764)
https://github.com/python/cpython/commit/6c942a86a4fb4c8b731cb1bd2933dba554eb79cd
History
Date User Action Args
2022-04-11 14:59:50adminsetgithub: 89538
2021-10-06 19:09:45steve.dowersetstatus: open -> closed
stage: patch review -> resolved
2021-10-06 19:09:41steve.dowersetmessages: + msg403333
2021-10-06 16:03:37steve.dowersetpriority: release blocker -> high

messages: + msg403322
2021-10-06 16:00:26steve.dowersetstage: resolved -> patch review
pull_requests: + pull_request27104
2021-10-06 14:26:28eryksunsetstatus: closed -> open
nosy: + eryksun
messages: + msg403304

2021-10-05 15:20:11steve.dowersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-10-05 12:37:54steve.dowersetmessages: + msg403236
2021-10-05 12:06:11steve.dowersetkeywords: + patch
stage: patch review
pull_requests: + pull_request27083
2021-10-05 11:43:14steve.dowersetmessages: + msg403230
2021-10-05 11:38:41steve.dowercreate