Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Anders Blomdell
apa
Commits
4acef0cb
Commit
4acef0cb
authored
Nov 28, 2018
by
Anders Blomdell
Browse files
Use types instead of imp
parent
9d37edfb
Changes
1
Show whitespace changes
Inline
Side-by-side
apa
View file @
4acef0cb
...
...
@@ -154,7 +154,7 @@ class Importer:
return None
def load_module(self, fullname):
mod = sys.modules.setdefault(fullname,
imp.new_modul
e(fullname))
mod = sys.modules.setdefault(fullname,
types.ModuleTyp
e(fullname))
(filename, src) = self.code[fullname]
mod.__file__ = filename
mod.__loader__ = self
...
...
@@ -213,7 +213,7 @@ if __name__ == '__main__':
import sys
importer = Importer(code)
sys.path_hooks.append(importer)
import
imp
import
types
try:
# This will start actual execution
importer.load_module("__main__")
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment