From: Nathan Binkert Date: Mon, 13 Aug 2007 20:39:22 +0000 (-0700) Subject: python: make the DictImporter's unload() work in any context. X-Git-Tag: m5_2.0_beta4~188 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9b4be6532741a511ca8f9e1d051269245814be8b;p=gem5.git python: make the DictImporter's unload() work in any context. import sys since sys may not be defined in whatever context the DictImporter is used. Also reset self.installed after an unload since the same DictImporter could be used again --HG-- extra : convert_revision : 988ed7ad8cd41b69e8fc583e618b1b4a146216da --- diff --git a/src/python/generate.py b/src/python/generate.py index 6b167552e..7c6ca1c5e 100644 --- a/src/python/generate.py +++ b/src/python/generate.py @@ -46,8 +46,10 @@ class DictImporter(object): self.unload() def unload(self): + import sys for module in self.installed: del sys.modules[module] + self.installed = set() def find_module(self, fullname, path): if fullname == '__scons':