[pypy-commit] pypy fast-gil: Fix tests
arigo
noreply at buildbot.pypy.org
Wed Jun 25 16:51:27 CEST 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: fast-gil
Changeset: r72216:4f7c28e34e18
Date: 2014-06-25 16:50 +0200
http://bitbucket.org/pypy/pypy/changeset/4f7c28e34e18/
Log: Fix tests
diff --git a/pypy/module/thread/gil.py b/pypy/module/thread/gil.py
--- a/pypy/module/thread/gil.py
+++ b/pypy/module/thread/gil.py
@@ -11,7 +11,7 @@
from pypy.module.thread.error import wrap_thread_error
from pypy.interpreter.executioncontext import PeriodicAsyncAction
from pypy.module.thread.threadlocals import OSThreadLocals
-from rpython.rlib.objectmodel import invoke_around_extcall
+from rpython.rlib.objectmodel import invoke_around_extcall, we_are_translated
from rpython.rlib.rposix import get_errno, set_errno
class GILThreadLocals(OSThreadLocals):
@@ -70,13 +70,15 @@
def before_external_call():
# this function must not raise, in such a way that the exception
# transformer knows that it cannot raise!
- rgil.gil_release()
+ if we_are_translated():
+ rgil.gil_release()
before_external_call._gctransformer_hint_cannot_collect_ = True
before_external_call._dont_reach_me_in_del_ = True
def after_external_call():
e = get_errno()
- rgil.gil_acquire()
+ if we_are_translated():
+ rgil.gil_acquire()
rthread.gc_thread_run()
after_thread_switch()
set_errno(e)
@@ -94,9 +96,10 @@
# explicitly release the gil, in a way that tries to give more
# priority to other threads (as opposed to continuing to run in
# the same thread).
- if rgil.gil_yield_thread():
- rthread.gc_thread_run()
- after_thread_switch()
+ if we_are_translated():
+ if rgil.gil_yield_thread():
+ rthread.gc_thread_run()
+ after_thread_switch()
do_yield_thread._gctransformer_hint_close_stack_ = True
do_yield_thread._dont_reach_me_in_del_ = True
do_yield_thread._dont_inline_ = True
More information about the pypy-commit
mailing list