Commit 4acef0cb authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Use types instead of imp

parent 9d37edfb
...@@ -154,7 +154,7 @@ class Importer: ...@@ -154,7 +154,7 @@ class Importer:
return None return None
def load_module(self, fullname): def load_module(self, fullname):
mod = sys.modules.setdefault(fullname, imp.new_module(fullname)) mod = sys.modules.setdefault(fullname, types.ModuleType(fullname))
(filename, src) = self.code[fullname] (filename, src) = self.code[fullname]
mod.__file__ = filename mod.__file__ = filename
mod.__loader__ = self mod.__loader__ = self
...@@ -213,7 +213,7 @@ if __name__ == '__main__': ...@@ -213,7 +213,7 @@ if __name__ == '__main__':
import sys import sys
importer = Importer(code) importer = Importer(code)
sys.path_hooks.append(importer) sys.path_hooks.append(importer)
import imp import types
try: try:
# This will start actual execution # This will start actual execution
importer.load_module("__main__") importer.load_module("__main__")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment