summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2024-08-13 20:44:57 (GMT)
committerGitHub <noreply@github.com>2024-08-13 20:44:57 (GMT)
commitee1b8ce26e700350e47a5f65201097121c41912e (patch)
treed20c7875e496ceca4c74a706f5536774e0fc0dd6 /Lib/importlib
parent5f6851152254b4b9d70af4ae5aea3f20965cee28 (diff)
downloadcpython-ee1b8ce26e700350e47a5f65201097121c41912e.zip
cpython-ee1b8ce26e700350e47a5f65201097121c41912e.tar.gz
cpython-ee1b8ce26e700350e47a5f65201097121c41912e.tar.bz2
gh-122907: Fix Builds Without HAVE_DYNAMIC_LOADING Set (gh-122952)
As of 529a160 (gh-118204), building with HAVE_DYNAMIC_LOADING stopped working. This is a minimal fix just to get builds working again. There are actually a number of long-standing deficiencies with HAVE_DYNAMIC_LOADING builds that need to be resolved separately.
Diffstat (limited to 'Lib/importlib')
-rw-r--r--Lib/importlib/_bootstrap_external.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
index 5bbcb37..1b76328 100644
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -1523,14 +1523,14 @@ def _get_supported_file_loaders():
Each item is a tuple (loader, suffixes).
"""
- if sys.platform in {"ios", "tvos", "watchos"}:
- extension_loaders = [(AppleFrameworkLoader, [
- suffix.replace(".so", ".fwork")
- for suffix in _imp.extension_suffixes()
- ])]
- else:
- extension_loaders = []
- extension_loaders.append((ExtensionFileLoader, _imp.extension_suffixes()))
+ extension_loaders = []
+ if hasattr(_imp, 'create_dynamic'):
+ if sys.platform in {"ios", "tvos", "watchos"}:
+ extension_loaders = [(AppleFrameworkLoader, [
+ suffix.replace(".so", ".fwork")
+ for suffix in _imp.extension_suffixes()
+ ])]
+ extension_loaders.append((ExtensionFileLoader, _imp.extension_suffixes()))
source = SourceFileLoader, SOURCE_SUFFIXES
bytecode = SourcelessFileLoader, BYTECODE_SUFFIXES
return extension_loaders + [source, bytecode]