]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-117398: Use the correct module loader for iOS in datetime CAPI test (GH...
authorneonene <53406459+neonene@users.noreply.github.com>
Wed, 10 Jul 2024 22:48:53 +0000 (07:48 +0900)
committerGitHub <noreply@github.com>
Wed, 10 Jul 2024 22:48:53 +0000 (06:48 +0800)
Use the correct binary module loader for iOS.

Lib/test/datetimetester.py

index 00819fda45289f6620120800db25e43b0f20539d..ca804fe28b32247b17d2be595a2be0434271e9c2 100644 (file)
@@ -6792,6 +6792,13 @@ class CapiTest(unittest.TestCase):
                     self.assertEqual(dt_orig, dt_rt)
 
     def test_type_check_in_subinterp(self):
+        # iOS requires the use of the custom framework loader,
+        # not the ExtensionFileLoader.
+        if sys.platform == "ios":
+            extension_loader = "AppleFrameworkLoader"
+        else:
+            extension_loader = "ExtensionFileLoader"
+
         script = textwrap.dedent(f"""
             if {_interpreters is None}:
                 import _testcapi as module
@@ -6801,7 +6808,7 @@ class CapiTest(unittest.TestCase):
                 import importlib.util
                 fullname = '_testcapi_datetime'
                 origin = importlib.util.find_spec('_testcapi').origin
-                loader = importlib.machinery.ExtensionFileLoader(fullname, origin)
+                loader = importlib.machinery.{extension_loader}(fullname, origin)
                 spec = importlib.util.spec_from_loader(fullname, loader)
                 module = importlib.util.module_from_spec(spec)
                 spec.loader.exec_module(module)