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: static build is broken
Type: behavior Stage:
Components: Library (Lib), Windows Versions: Python 3.11, Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, egorpugin, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2021-10-27 10:30 by egorpugin, last changed 2022-04-11 14:59 by admin.

Messages (4)
msg405082 - (view) Author: (egorpugin) Date: 2021-10-27 10:30
Static build is not working any more since 3.10.

'winver' member is only defined with dll build.

See master - 'winver' call which is not available for windows+static build.
https://github.com/python/cpython/blob/main/Lib/site.py#L292

See 3.9 file - no 'winver' call.
https://github.com/python/cpython/blob/1016ef37904c7ddc16fb18d3369b2a78cf428fa4/Lib/site.py#L266

Error:
```
1>EXEC : Fatal Python error : init_import_site: Failed to import the site module
1>Python runtime state: initialized
1>Traceback (most recent call last):
1>  File "D:\dev\swst\pkg\8b\0a\10a9\src\sdir\Lib\site.py", line 657, in <module>
1>    main()
1>  File "D:\dev\swst\pkg\8b\0a\10a9\src\sdir\Lib\site.py", line 643, in main
1>    known_paths = addusersitepackages(known_paths)
1>  File "D:\dev\swst\pkg\8b\0a\10a9\src\sdir\Lib\site.py", line 380, in addusersitepackages
1>    user_site = getusersitepackages()
1>  File "D:\dev\swst\pkg\8b\0a\10a9\src\sdir\Lib\site.py", line 367, in getusersitepackages
1>    USER_SITE = _get_path(userbase)
1>  File "D:\dev\swst\pkg\8b\0a\10a9\src\sdir\Lib\site.py", line 332, in _get_path
1>    ver_nodot = sys.winver.replace('.', '')
1>AttributeError: module 'sys' has no attribute 'winver'
```
msg405116 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-10-27 17:48
Steve changed the line in comment dd18001c308f / bpo-41627.
msg405117 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-10-27 17:48
Full commit hash is dd18001c308fb3bb65006c91d95f6639583a3420
msg405267 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-10-28 21:03
winver is static data, so no reason we can't define it all the time.

Unassigning myself - if anyone else would like to work on this, feel free.
History
Date User Action Args
2022-04-11 14:59:51adminsetgithub: 89786
2021-10-28 21:03:21steve.dowersetassignee: steve.dower ->
messages: + msg405267
2021-10-27 17:48:51christian.heimessetmessages: + msg405117
2021-10-27 17:48:11christian.heimessetnosy: + christian.heimes, paul.moore, tim.golden, zach.ware, steve.dower
messages: + msg405116

assignee: steve.dower
components: + Windows
2021-10-27 11:24:24egorpuginsetcomponents: + Library (Lib)
2021-10-27 10:30:32egorpugincreate