Skip to content

Commit 799fb36

Browse files
committed
gh-145616: Detect Android sysconfig ABI correctly on 32-bit ARM Android on 64-bit ARM kernel
- When Python is running on 32-bit ARM Android on a 64-bit ARM kernel, `os.uname().machine` is `armv8l`. Such devices run the same userspace code as `armv7l` devices, so apply the same `armeabi_v7a` Android ABI to them, which works. - Issue: #145616
1 parent 9159287 commit 799fb36

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Lib/sysconfig/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,11 +696,15 @@ def get_platform():
696696
release = get_config_var("ANDROID_API_LEVEL")
697697

698698
# Wheel tags use the ABI names from Android's own tools.
699+
# When Python is running on 32-bit ARM Android on a 64-bit ARM kernel,
700+
# 'os.uname().machine' is 'armv8l'. Such devices run the same userspace
701+
# code as 'armv7l' devices.
699702
machine = {
700703
"x86_64": "x86_64",
701704
"i686": "x86",
702705
"aarch64": "arm64_v8a",
703706
"armv7l": "armeabi_v7a",
707+
"armv8l": "armeabi_v7a",
704708
}[machine]
705709
elif osname == "linux":
706710
# At least on Linux/Intel, 'machine' is the processor --

Lib/test/test_sysconfig.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ def test_get_platform(self):
378378
'i686': 'x86',
379379
'aarch64': 'arm64_v8a',
380380
'armv7l': 'armeabi_v7a',
381+
'armv8l': 'armeabi_v7a',
381382
}.items():
382383
with self.subTest(machine):
383384
self._set_uname(('Linux', 'localhost', '3.18.91+',
@@ -586,6 +587,7 @@ def test_android_ext_suffix(self):
586587
"i686": "i686-linux-android",
587588
"aarch64": "aarch64-linux-android",
588589
"armv7l": "arm-linux-androideabi",
590+
"armv8l": "arm-linux-androideabi",
589591
}[machine]
590592
self.assertEndsWith(suffix, f"-{expected_triplet}.so")
591593

0 commit comments

Comments
 (0)