[pypy-svn] r78006 - pypy/branch/fast-forward/pypy/module/imp

afa at codespeak.net afa at codespeak.net
Fri Oct 15 19:26:06 CEST 2010


Author: afa
Date: Fri Oct 15 19:26:04 2010
New Revision: 78006

Modified:
   pypy/branch/fast-forward/pypy/module/imp/__init__.py
Log:
Grab and release the import lock when forking the interpreter.

I could not find any test for this change, but:
- CPython 2.7 has similar code
- when translated, it helps a lot test_multiprocessing, which did not even start a single test before.


Modified: pypy/branch/fast-forward/pypy/module/imp/__init__.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/imp/__init__.py	(original)
+++ pypy/branch/fast-forward/pypy/module/imp/__init__.py	Fri Oct 15 19:26:04 2010
@@ -38,9 +38,9 @@
     def __init__(self, space, *args):
         "NOT_RPYTHON"
         MixedModule.__init__(self, space, *args)
-        # from pypy.module.posix.interp_posix import add_fork_hook
-        # from pypy.module.imp import interp_imp
-        # add_fork_hook('before', interp_imp.acquire_lock)
-        # add_fork_hook('parent', interp_imp.release_lock)
-        # add_fork_hook('child', interp_imp.reinit_lock)
+        from pypy.module.posix.interp_posix import add_fork_hook
+        from pypy.module.imp import interp_imp
+        add_fork_hook('before', interp_imp.acquire_lock)
+        add_fork_hook('parent', interp_imp.release_lock)
+        add_fork_hook('child', interp_imp.reinit_lock)
 



More information about the Pypy-commit mailing list