From c6718317351fda5ec05a0132358e2907dc6b2394 Mon Sep 17 00:00:00 2001
From: Brennan Ashton <bashton@brennanashton.com>
Date: Sun, 4 Nov 2018 09:17:10 -0800
Subject: grc: Simplify py2/3 logic for new_module

---
 grc/core/FlowGraph.py | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

(limited to 'grc/core/FlowGraph.py')

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:
-- 
cgit v1.2.3