summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-03-17 22:48:16 (GMT)
committerBrett Cannon <brett@python.org>2013-03-17 22:48:16 (GMT)
commit3e2fe05e62e061032d81becb2f9ef1a8def54f63 (patch)
tree8f60f2cc6a1bf78a8a94aea7051cfb98cc826352
parentb271727bad803ef50fdef185eeda24222fba4f25 (diff)
downloadcpython-3e2fe05e62e061032d81becb2f9ef1a8def54f63.zip
cpython-3e2fe05e62e061032d81becb2f9ef1a8def54f63.tar.gz
cpython-3e2fe05e62e061032d81becb2f9ef1a8def54f63.tar.bz2
Issue #16880: _imp.load_dynamic() is not defined on a platform that
does not support dynamic loading (e.g. Atari), so make sure that imp doesn't assume it always exists. Patch by Christian Heimes.
-rw-r--r--Lib/imp.py9
-rw-r--r--Misc/NEWS2
2 files changed, 9 insertions, 2 deletions
diff --git a/Lib/imp.py b/Lib/imp.py
index da9c84e..7a7079f 100644
--- a/Lib/imp.py
+++ b/Lib/imp.py
@@ -7,9 +7,14 @@ functionality over this module.
"""
# (Probably) need to stay in _imp
from _imp import (lock_held, acquire_lock, release_lock,
- load_dynamic, get_frozen_object, is_frozen_package,
+ get_frozen_object, is_frozen_package,
init_builtin, init_frozen, is_builtin, is_frozen,
_fix_co_filename)
+try:
+ from _imp import load_dynamic
+except ImportError:
+ # Platform doesn't support dynamic loading.
+ load_dynamic = None
# Directly exposed by this module
from importlib._bootstrap import new_module
@@ -160,7 +165,7 @@ def load_module(name, file, filename, details):
return load_source(name, filename, file)
elif type_ == PY_COMPILED:
return load_compiled(name, filename, file)
- elif type_ == C_EXTENSION:
+ elif type_ == C_EXTENSION and load_dynamic is not None:
return load_dynamic(name, filename, file)
elif type_ == PKG_DIRECTORY:
return load_package(name, filename)
diff --git a/Misc/NEWS b/Misc/NEWS
index 2cdb491..a92caf2 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -193,6 +193,8 @@ Core and Builtins
Library
-------
+Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module.
+
- Issue #16389: Fixed a performance regression relative to Python 3.1 in the
caching of compiled regular expressions.