Skip to content

Commit

Permalink
pythongh-117398: Use the correct module loader for iOS in datetime CA…
Browse files Browse the repository at this point in the history
…PI test. (python#120477)

Use the correct loader for iOS.
  • Loading branch information
freakboy3742 authored and estyxx committed Jul 17, 2024
1 parent 1d65c11 commit baacac8
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 @@ -6786,6 +6786,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 @@ -6795,7 +6802,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 baacac8

Please sign in to comment.