summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/build/changelog/unreleased_12/pr473.rst9
-rw-r--r--lib/sqlalchemy/util/langhelpers.py2
2 files changed, 10 insertions, 1 deletions
diff --git a/doc/build/changelog/unreleased_12/pr473.rst b/doc/build/changelog/unreleased_12/pr473.rst
new file mode 100644
index 000000000..6ee55164f
--- /dev/null
+++ b/doc/build/changelog/unreleased_12/pr473.rst
@@ -0,0 +1,9 @@
+.. change::
+ :tags: bug, misc
+
+ Fixed issue where part of the utility language helper internals was passing
+ the wrong kind of argument to the Python ``__import__`` builtin as the list
+ of modules to be imported. The issue produced no symptoms within the core
+ library but could cause issues with external applications that redefine the
+ ``__import__`` builtin or otherwise instrument it. Pull request courtesy Joe
+ Urciuoli.
diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py
index 81bfee30a..c2ebf7637 100644
--- a/lib/sqlalchemy/util/langhelpers.py
+++ b/lib/sqlalchemy/util/langhelpers.py
@@ -859,7 +859,7 @@ def dependency_for(modulename):
# unfortunately importlib doesn't work that great either
tokens = modulename.split(".")
mod = compat.import_(
- ".".join(tokens[0:-1]), globals(), locals(), tokens[-1])
+ ".".join(tokens[0:-1]), globals(), locals(), [tokens[-1]])
mod = getattr(mod, tokens[-1])
setattr(mod, obj.__name__, obj)
return obj