https://github.com/python/cpython/commit/e76dbc87a28f611d3eeb664da9dfc272df69279e
commit: e76dbc87a28f611d3eeb664da9dfc272df69279e
branch: 3.14
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: freakboy3742 <russ...@keith-magee.com>
date: 2025-06-12T04:28:47Z
summary:

[3.14] gh-128627: Fix iPad detection in wasm-gc (GH-135388) (#135419)

On some iPad versions, Safari reports as "macOS". Modifies the GC trampoline 
detection
to add a feature-based check to detect this case.
(cherry picked from commit d4471297586335d8c24db8b2c030d32c94570344)

Co-authored-by: Gyeongjae Choi <def6...@gmail.com>

files:
M Python/emscripten_trampoline.c

diff --git a/Python/emscripten_trampoline.c b/Python/emscripten_trampoline.c
index cc5047d6bda224..975c28eec104c6 100644
--- a/Python/emscripten_trampoline.c
+++ b/Python/emscripten_trampoline.c
@@ -71,7 +71,16 @@ EM_JS(CountArgsFunc, _PyEM_GetCountArgsPtr, (), {
 // )
 
 function getPyEMCountArgsPtr() {
-    let isIOS = globalThis.navigator && 
/iPad|iPhone|iPod/.test(navigator.platform);
+    // Starting with iOS 18.3.1, WebKit on iOS has an issue with the garbage
+    // collector that breaks the call trampoline. See #130418 and
+    // https://bugs.webkit.org/show_bug.cgi?id=293113 for details.
+    let isIOS = globalThis.navigator && (
+        /iPad|iPhone|iPod/.test(navigator.userAgent) ||
+        // Starting with iPadOS 13, iPads might send a platform string that 
looks like a desktop Mac.
+        // To differentiate, we check if the platform is 'MacIntel' (common 
for Macs and newer iPads)
+        // AND if the device has multi-touch capabilities 
(navigator.maxTouchPoints > 1)
+        (navigator.platform === 'MacIntel' && typeof navigator.maxTouchPoints 
!== 'undefined' && navigator.maxTouchPoints > 1)
+    )
     if (isIOS) {
         return 0;
     }

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: arch...@mail-archive.com

Reply via email to