Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions module/prepare_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,10 @@ def _python(ver: BranchProfile, paths: ProjectPaths, download_only: bool):
patch(paths.src_dir.python, paths.patch_dir / 'python/fix-mingw-build_3.12.patch')
shutil.copy(paths.patch_dir / 'python/python-config.sh', paths.src_dir.python / 'python-config.sh')

# Fix CPUID use
if v >= Version('3.13'):
patch(paths.src_dir.python, paths.patch_dir / 'python/mimalloc-cpuid-check.patch')

patch_done(paths.src_dir.python)

def _setuptools(ver: BranchProfile, paths: ProjectPaths, download_only: bool):
Expand Down
14 changes: 14 additions & 0 deletions patch/python/mimalloc-cpuid-check.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- a/Objects/mimalloc/init.c 2026-06-27 03:20:13.530317083 +1000
+++ b/Objects/mimalloc/init.c 2026-06-27 03:22:47.593182651 +1000
@@ -529,8 +529,9 @@

static void mi_detect_cpu_features(void) {
// FSRM for fast rep movsb support (AMD Zen3+ (~2020) or Intel Ice Lake+ (~2017))
- int32_t cpu_info[4];
- __cpuid(cpu_info, 7);
+ int32_t cpu_info[4] = {0};
+ if (__get_cpuid_max(0, NULL) > 0)
+ __cpuid(cpu_info, 7);
_mi_cpu_has_fsrm = ((cpu_info[3] & (1 << 4)) != 0); // bit 4 of EDX : see <https://en.wikipedia.org/wiki/CPUID#EAX=7,_ECX=0:_Extended_Features>
}
#else
Loading