mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
gh-114099 - Add iOS framework loading machinery. (GH-116454)
Co-authored-by: Malcolm Smith <smith@chaquo.com> Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
This commit is contained in:
parent
a557478987
commit
408e127159
22 changed files with 302 additions and 62 deletions
|
|
@ -2056,6 +2056,13 @@ class SubinterpreterTest(unittest.TestCase):
|
|||
self.addCleanup(os.close, r)
|
||||
self.addCleanup(os.close, w)
|
||||
|
||||
# Apple extensions must be distributed as frameworks. This requires
|
||||
# a specialist loader.
|
||||
if support.is_apple_mobile:
|
||||
loader = "AppleFrameworkLoader"
|
||||
else:
|
||||
loader = "ExtensionFileLoader"
|
||||
|
||||
script = textwrap.dedent(f"""
|
||||
import importlib.machinery
|
||||
import importlib.util
|
||||
|
|
@ -2063,7 +2070,7 @@ class SubinterpreterTest(unittest.TestCase):
|
|||
|
||||
fullname = '_test_module_state_shared'
|
||||
origin = importlib.util.find_spec('_testmultiphase').origin
|
||||
loader = importlib.machinery.ExtensionFileLoader(fullname, origin)
|
||||
loader = importlib.machinery.{loader}(fullname, origin)
|
||||
spec = importlib.util.spec_from_loader(fullname, loader)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
attr_id = str(id(module.Error)).encode()
|
||||
|
|
@ -2371,7 +2378,12 @@ class Test_ModuleStateAccess(unittest.TestCase):
|
|||
def setUp(self):
|
||||
fullname = '_testmultiphase_meth_state_access' # XXX
|
||||
origin = importlib.util.find_spec('_testmultiphase').origin
|
||||
loader = importlib.machinery.ExtensionFileLoader(fullname, origin)
|
||||
# Apple extensions must be distributed as frameworks. This requires
|
||||
# a specialist loader.
|
||||
if support.is_apple_mobile:
|
||||
loader = importlib.machinery.AppleFrameworkLoader(fullname, origin)
|
||||
else:
|
||||
loader = importlib.machinery.ExtensionFileLoader(fullname, origin)
|
||||
spec = importlib.util.spec_from_loader(fullname, loader)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
loader.exec_module(module)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue