Skip to content

Commit 3a2b81e

Browse files
gh-145616: Detect Android sysconfig ABI correctly on 32-bit ARM Android on 64-bit ARM kernel (GH-145617)
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.
1 parent 1516c26 commit 3a2b81e

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

Lib/sysconfig/__init__.py

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

696696
# Wheel tags use the ABI names from Android's own tools.
697+
# When Python is running on 32-bit ARM Android on a 64-bit ARM kernel,
698+
# 'os.uname().machine' is 'armv8l'. Such devices run the same userspace
699+
# code as 'armv7l' devices.
697700
machine = {
698701
"x86_64": "x86_64",
699702
"i686": "x86",
700703
"aarch64": "arm64_v8a",
701704
"armv7l": "armeabi_v7a",
705+
"armv8l": "armeabi_v7a",
702706
}[machine]
703707
elif osname == "linux":
704708
# 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
@@ -375,6 +375,7 @@ def test_get_platform(self):
375375
'i686': 'x86',
376376
'aarch64': 'arm64_v8a',
377377
'armv7l': 'armeabi_v7a',
378+
'armv8l': 'armeabi_v7a',
378379
}.items():
379380
with self.subTest(machine):
380381
self._set_uname(('Linux', 'localhost', '3.18.91+',
@@ -583,6 +584,7 @@ def test_android_ext_suffix(self):
583584
"i686": "i686-linux-android",
584585
"aarch64": "aarch64-linux-android",
585586
"armv7l": "arm-linux-androideabi",
587+
"armv8l": "arm-linux-androideabi",
586588
}[machine]
587589
self.assertEndsWith(suffix, f"-{expected_triplet}.so")
588590

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Detect Android sysconfig ABI correctly on 32-bit ARM Android on 64-bit ARM kernel

0 commit comments

Comments
 (0)