From: neonene <53406459+neonene@users.noreply.github.com> Date: Wed, 10 Jul 2024 22:48:53 +0000 (+0900) Subject: [3.13] gh-117398: Use the correct module loader for iOS in datetime CAPI test (GH... X-Git-Tag: v3.13.0b4~81 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c08a302249edba844a26e1a0231671afd92b973d;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-117398: Use the correct module loader for iOS in datetime CAPI test (GH-120477) (#121561) Use the correct binary module loader for iOS. --- diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index 00819fda4528..ca804fe28b32 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -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)