[pypy-commit] pypy default: Hack more, trying to work around both CPython's test_imp.py and
arigo
noreply at buildbot.pypy.org
Sun Jun 2 22:21:49 CEST 2013
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r64716:6c22c424ddb8
Date: 2013-06-02 22:21 +0200
http://bitbucket.org/pypy/pypy/changeset/6c22c424ddb8/
Log: Hack more, trying to work around both CPython's test_imp.py and
CPython's buggy corresponding behavior
(http://bugs.python.org/issue18122).
diff --git a/pypy/module/imp/importing.py b/pypy/module/imp/importing.py
--- a/pypy/module/imp/importing.py
+++ b/pypy/module/imp/importing.py
@@ -303,7 +303,7 @@
return _absolute_import(space, modulename, baselevel,
fromlist_w, tentative)
finally:
- lock.release_lock()
+ lock.release_lock(silent_after_fork=True)
@jit.unroll_safe
def absolute_import_try(space, modulename, baselevel, fromlist_w):
@@ -788,10 +788,10 @@
self.lockowner = me
self.lockcounter += 1
- def release_lock(self):
+ def release_lock(self, silent_after_fork):
me = self.space.getexecutioncontext() # used as thread ident
if self.lockowner is not me:
- if self.lockowner is None:
+ if self.lockowner is None and silent_after_fork:
# Too bad. This situation can occur if a fork() occurred
# with the import lock held, and we're the child.
return
diff --git a/pypy/module/imp/interp_imp.py b/pypy/module/imp/interp_imp.py
--- a/pypy/module/imp/interp_imp.py
+++ b/pypy/module/imp/interp_imp.py
@@ -177,7 +177,7 @@
def release_lock(space):
if space.config.objspace.usemodules.thread:
- importing.getimportlock(space).release_lock()
+ importing.getimportlock(space).release_lock(silent_after_fork=False)
def reinit_lock(space):
if space.config.objspace.usemodules.thread:
More information about the pypy-commit
mailing list