From 9b4be6532741a511ca8f9e1d051269245814be8b Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Mon, 13 Aug 2007 13:39:22 -0700 Subject: [PATCH] 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 --- src/python/generate.py | 2 ++ 1 file changed, 2 insertions(+) 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': -- 2.30.2