]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
import the module as passed before we look in sys.modules
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 13 Mar 2020 22:37:25 +0000 (18:37 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 17 Mar 2020 14:12:36 +0000 (10:12 -0400)
in I2e291eba4297867fc0ddb5d875b9f7af34751d01, the importer
is importing tokens[0:-1] and then the final token as the name;
this doesn't always work for the two example modules of "xml.dom"
and "wsgiref.simple_server".  import the complete path we will
pull from sys.modules directly.

Change-Id: I833a770f4c3e7463fa56234d891870083e48cc73

lib/sqlalchemy/util/langhelpers.py

index bac95c7e3ec7a868e8186862ad3f7dbf39a79142..474463981544493aceddc9681f2b59249a1191c9 100644 (file)
@@ -1026,10 +1026,7 @@ class _ModuleRegistry:
         for module in self.module_registry:
             key = module.split("sqlalchemy.")[-1].replace(".", "_")
             if module.startswith(path) and key not in self.__dict__:
-                tokens = module.split(".")
-                compat.import_(
-                    ".".join(tokens[0:-1]), globals(), locals(), [tokens[-1]]
-                )
+                compat.import_(module, globals(), locals())
                 self.__dict__[key] = sys.modules[module]