[Python-checkins] cpython: Issue #17177: Stop using imp in multiprocessing

brett.cannon python-checkins at python.org
Sat Jun 15 19:23:09 CEST 2013


http://hg.python.org/cpython/rev/0b96a16656b7
changeset:   84142:0b96a16656b7
user:        Brett Cannon <brett at python.org>
date:        Sat Jun 15 13:23:01 2013 -0400
summary:
  Issue #17177: Stop using imp in multiprocessing

files:
  Lib/multiprocessing/forking.py |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Lib/multiprocessing/forking.py b/Lib/multiprocessing/forking.py
--- a/Lib/multiprocessing/forking.py
+++ b/Lib/multiprocessing/forking.py
@@ -449,8 +449,8 @@
         elif main_name != 'ipython':
             # Main modules not actually called __main__.py may
             # contain additional code that should still be executed
-            import imp
             import importlib
+            import types
 
             if main_path is None:
                 dirs = None
@@ -465,7 +465,7 @@
             # since that would execute 'if __name__ == "__main__"'
             # clauses, potentially causing a psuedo fork bomb.
             loader = importlib.find_loader(main_name, path=dirs)
-            main_module = imp.new_module(main_name)
+            main_module = types.ModuleType(main_name)
             try:
                 loader.init_module_attrs(main_module)
             except AttributeError:  # init_module_attrs is optional

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list