diff options
author | Brennan Ashton <bashton@brennanashton.com> | 2018-11-04 09:17:10 -0800 |
---|---|---|
committer | Andrej Rode <mail@andrejro.de> | 2018-11-12 12:31:16 +0100 |
commit | c6718317351fda5ec05a0132358e2907dc6b2394 (patch) | |
tree | 6e533513bfc62105cf9cf446f9bc9d4ce7871414 /grc/core/FlowGraph.py | |
parent | 9def7b29897e137f4936fbbaaae990910c0913a1 (diff) |
grc: Simplify py2/3 logic for new_module
Diffstat (limited to 'grc/core/FlowGraph.py')
-rw-r--r-- | grc/core/FlowGraph.py | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/grc/core/FlowGraph.py b/grc/core/FlowGraph.py index 138ae44ee5..72d0594081 100644 --- a/grc/core/FlowGraph.py +++ b/grc/core/FlowGraph.py @@ -20,6 +20,7 @@ from __future__ import absolute_import, print_function import collections import itertools import sys +import types from operator import methodcaller, attrgetter from . import Messages, blocks @@ -29,16 +30,6 @@ from .utils import expr_utils from .utils.backports import shlex -if sys.version_info[0] < 3: - import imp - def _new_module_helper(name): - return imp.new_module(name) -else: - import types - def _new_module_helper(name): - return types.ModuleType(name) - - class FlowGraph(Element): is_flow_graph = True @@ -201,7 +192,7 @@ class FlowGraph(Element): for id, expr in self.get_python_modules(): try: - module = _new_module_helper(id) + module = types.ModuleType(id) exec(expr, module.__dict__) namespace[id] = module except: |