--- a/cubicweb/__init__.py Mon Feb 06 15:43:19 2017 +0100
+++ b/cubicweb/__init__.py Wed Feb 08 10:31:26 2017 +0100
@@ -307,6 +307,13 @@
return pkgutil.ImpLoader(fullname, *modinfo)
def load_module(self, fullname):
+ try:
+ # If there is an existing module object named 'fullname' in
+ # sys.modules , the loader must use that existing module.
+ # Otherwise, the reload() builtin will not work correctly.
+ return sys.modules[fullname]
+ except KeyError:
+ pass
if fullname != 'cubes':
raise ImportError('No module named {0}'.format(fullname))
mod = sys.modules[fullname] = types.ModuleType(fullname, doc='CubicWeb cubes')