Skip to content

Commit

Permalink
[3.13] gh-117398: Use the correct module loader for iOS in datetime C…
Browse files Browse the repository at this point in the history
…API test (GH-120477) (#121561)

Use the correct binary module loader for iOS.
  • Loading branch information
neonene authored Jul 10, 2024
1 parent 5bb1175 commit c08a302
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Lib/test/datetimetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -6792,6 +6792,13 @@ def test_datetime_from_timestamp(self):
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
Expand All @@ -6801,7 +6808,7 @@ def test_type_check_in_subinterp(self):
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)
Expand Down

0 comments on commit c08a302

Please sign in to comment.