diff options
author | Fred Drake <fdrake@acm.org> | 2000-04-13 14:52:27 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-04-13 14:52:27 (GMT) |
commit | 8deecedc6d4b4c7cb914ad0220c3db0ef33dc8d8 (patch) | |
tree | ab80df57cd0ac0201d06f9cc2859019ff8d331f6 /Lib | |
parent | 10dfd4c1c3cf4931859e6258ecd3a7fd28829957 (diff) | |
download | cpython-8deecedc6d4b4c7cb914ad0220c3db0ef33dc8d8.zip cpython-8deecedc6d4b4c7cb914ad0220c3db0ef33dc8d8.tar.gz cpython-8deecedc6d4b4c7cb914ad0220c3db0ef33dc8d8.tar.bz2 |
Thomas Heller <thomas.heller@ion-tof.com>:
ihooks.ModuleLoader does not implement reload(mod) correctly:
If mod has already been loaded by ModuleLoader, it has
been returned from a cache. Added an additional parameter
to import_it() to force reloading.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/ihooks.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/ihooks.py b/Lib/ihooks.py index 5c9adfe..3f1984c 100644 --- a/Lib/ihooks.py +++ b/Lib/ihooks.py @@ -467,13 +467,14 @@ class ModuleImporter(BasicModuleImporter): if not submod: raise ImportError, "No module named " + subname - def import_it(self, partname, fqname, parent): + def import_it(self, partname, fqname, parent, force_load=0): if not partname: raise ValueError, "Empty module name" - try: - return self.modules[fqname] - except KeyError: - pass + if not force_load: + try: + return self.modules[fqname] + except KeyError: + pass try: path = parent and parent.__path__ except AttributeError: @@ -489,11 +490,11 @@ class ModuleImporter(BasicModuleImporter): def reload(self, module): name = module.__name__ if '.' not in name: - return self.import_it(name, name, None) + return self.import_it(name, name, None, force_load=1) i = string.rfind(name, '.') pname = name[:i] parent = self.modules[pname] - return self.import_it(name[i+1:], name, parent) + return self.import_it(name[i+1:], name, parent, force_load=1) default_importer = None |