mirror of https://github.com/python/cpython
gh-117398: Use the correct module loader for iOS in datetime CAPI test. (#120477)
Use the correct loader for iOS.
This commit is contained in:
parent
92f6d400f7
commit
5c58e728b1
|
@ -6786,6 +6786,13 @@ class CapiTest(unittest.TestCase):
|
||||||
self.assertEqual(dt_orig, dt_rt)
|
self.assertEqual(dt_orig, dt_rt)
|
||||||
|
|
||||||
def test_type_check_in_subinterp(self):
|
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"""
|
script = textwrap.dedent(f"""
|
||||||
if {_interpreters is None}:
|
if {_interpreters is None}:
|
||||||
import _testcapi as module
|
import _testcapi as module
|
||||||
|
@ -6795,7 +6802,7 @@ class CapiTest(unittest.TestCase):
|
||||||
import importlib.util
|
import importlib.util
|
||||||
fullname = '_testcapi_datetime'
|
fullname = '_testcapi_datetime'
|
||||||
origin = importlib.util.find_spec('_testcapi').origin
|
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)
|
spec = importlib.util.spec_from_loader(fullname, loader)
|
||||||
module = importlib.util.module_from_spec(spec)
|
module = importlib.util.module_from_spec(spec)
|
||||||
spec.loader.exec_module(module)
|
spec.loader.exec_module(module)
|
||||||
|
|
Loading…
Reference in New Issue