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: Freeze fails to compile on windows
Type: compile error Stage:
Components: Demos and Tools, Windows Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Liran Ringel, eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2016-12-31 17:51 by Liran Ringel, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
fix-freeze-on-windows.patch Liran Ringel, 2016-12-31 17:51 fix-freeze-on-windows.patch review
Messages (4)
msg284405 - (view) Author: Liran Ringel (Liran Ringel) * Date: 2016-12-31 17:51
The patch fixes 3 bugs:
1. Include Python.h in frozen_dllmain.c - needed for Py_ARRAY_LENGTH symbol
2. DL_IMPORT is used in checkextensions_win32.py, but it's deprecated and not defined anymore. Replaced it with __declspec(dllimport)
3. Fix python lib path in winmakemakefile.py

There is one more thing left to do to make it work, but it already has an open issue:
http://bugs.python.org/issue28068
msg284454 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2017-01-02 04:20
Is platform.architecture() the right way to determine what platform you're targeting? This will tell you the current OS, but typically you want to know the architecture of the Python process (since you often run 32-bit processes on 64-bit Windows). If you just want the Python process, checking "sys.winver.endswith('-32')" is the easiest way in 3.5 and later to see whether it's 32-bit Python.

Otherwise those changes look okay to me.
msg284473 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2017-01-02 07:49
Using platform.architecture [1] is fine here. `bits` defaults to the size of a pointer in the current process, i.e. `struct.calcsize('P') * 8`. 

On Windows, it's useless for anything except the default parameters. It doesn't call GetBinaryType [2] to distinguish 32-bit and 64-bit executables, so from a 64-bit process it will incorrectly return that a 32-bit executable is 64-bit.

[1]: https://docs.python.org/3/library/platform.html#platform.architecture
[2]: https://msdn.microsoft.com/en-us/library/aa364819
msg284483 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2017-01-02 14:22
Ah, I was thinking of platform.machine().
History
Date User Action Args
2022-04-11 14:58:41adminsetgithub: 73310
2021-03-13 19:20:35eryksunsetversions: + Python 3.8, Python 3.9, Python 3.10, - Python 3.5, Python 3.6, Python 3.7
2017-01-02 14:22:03steve.dowersetmessages: + msg284483
2017-01-02 07:49:02eryksunsetnosy: + eryksun
messages: + msg284473
2017-01-02 04:20:50steve.dowersetmessages: + msg284454
2016-12-31 17:51:05Liran Ringelcreate