From 793812b104e01ec2e2274372a00a3853ca0e222c Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Sat, 28 Mar 2026 07:25:35 +0000 Subject: [PATCH] [3.13] gh-145616: Detect Android sysconfig ABI correctly on 32-bit ARM Android on 64-bit ARM kernel (GH-145617) (#146539) 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. (cherry picked from commit 3a2b81e919103c0be3bc60a47aaa74d34fea6e9e) Co-authored-by: Robert Kirkman <31490854+robertkirkman@users.noreply.github.com> --- Lib/sysconfig/__init__.py | 4 ++++ Lib/test/test_sysconfig.py | 2 ++ .../Library/2026-03-07-02-44-52.gh-issue-145616.x8Mf23.rst | 1 + 3 files changed, 7 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2026-03-07-02-44-52.gh-issue-145616.x8Mf23.rst diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py index f7bd675bb3ba..b24dd1dd9c23 100644 --- a/Lib/sysconfig/__init__.py +++ b/Lib/sysconfig/__init__.py @@ -644,11 +644,15 @@ def get_platform(): release = get_config_var("ANDROID_API_LEVEL") # Wheel tags use the ABI names from Android's own tools. + # 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. machine = { "x86_64": "x86_64", "i686": "x86", "aarch64": "arm64_v8a", "armv7l": "armeabi_v7a", + "armv8l": "armeabi_v7a", }[machine] else: # At least on Linux/Intel, 'machine' is the processor -- diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index 9723300f515f..78a55768fce8 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -377,6 +377,7 @@ class TestSysConfig(unittest.TestCase): 'i686': 'x86', 'aarch64': 'arm64_v8a', 'armv7l': 'armeabi_v7a', + 'armv8l': 'armeabi_v7a', }.items(): with self.subTest(machine): self._set_uname(('Linux', 'localhost', '3.18.91+', @@ -589,6 +590,7 @@ class TestSysConfig(unittest.TestCase): "i686": "i686-linux-android", "aarch64": "aarch64-linux-android", "armv7l": "arm-linux-androideabi", + "armv8l": "arm-linux-androideabi", }[machine] self.assertTrue(suffix.endswith(f"-{expected_triplet}.so"), f"{machine=}, {suffix=}") diff --git a/Misc/NEWS.d/next/Library/2026-03-07-02-44-52.gh-issue-145616.x8Mf23.rst b/Misc/NEWS.d/next/Library/2026-03-07-02-44-52.gh-issue-145616.x8Mf23.rst new file mode 100644 index 000000000000..131570a0e03d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-03-07-02-44-52.gh-issue-145616.x8Mf23.rst @@ -0,0 +1 @@ +Detect Android sysconfig ABI correctly on 32-bit ARM Android on 64-bit ARM kernel -- 2.47.3