Commit 99435fa
committed
Fix architecture detection to use Python interpreter bitness
Replace platform.machine() with struct.calcsize('P') for x86/x64 detection.
platform.machine() returns OS architecture (e.g., 'AMD64' for 64-bit Windows),
which incorrectly causes 32-bit Python on 64-bit Windows to load 64-bit DLLs.
Changes:
- Use struct.calcsize('P') * 8 to detect Python interpreter bitness (32 vs 64-bit)
- Keep platform.machine() only for ARM64 architecture detection
- Fix regression introduced in 1.4.0 that broke 32-bit Python support
- Add debug logging for Python interpreter bitness
Fixes architecture mismatch errors when using 32-bit Python on 64-bit Windows.1 parent b4f7a00 commit 99435fa
1 file changed
+12
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
75 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
76 | 81 | | |
77 | 82 | | |
78 | 83 | | |
79 | | - | |
| 84 | + | |
80 | 85 | | |
81 | 86 | | |
82 | 87 | | |
| |||
86 | 91 | | |
87 | 92 | | |
88 | 93 | | |
89 | | - | |
90 | | - | |
| 94 | + | |
| 95 | + | |
91 | 96 | | |
92 | | - | |
| 97 | + | |
93 | 98 | | |
94 | | - | |
| 99 | + | |
95 | 100 | | |
96 | | - | |
| 101 | + | |
97 | 102 | | |
98 | 103 | | |
99 | 104 | | |
| |||
0 commit comments