Author: Armin Rigo <[email protected]>
Branch:
Changeset: r48085:6048a0bf9e33
Date: 2011-10-16 16:13 +0200
http://bitbucket.org/pypy/pypy/changeset/6048a0bf9e33/
Log: Fix the test: calling sleep() may not release the GIL before
translation.
diff --git a/pypy/module/sys/test/test_sysmodule.py
b/pypy/module/sys/test/test_sysmodule.py
--- a/pypy/module/sys/test/test_sysmodule.py
+++ b/pypy/module/sys/test/test_sysmodule.py
@@ -568,20 +568,22 @@
import thread
thread_id = thread.get_ident()
- self.ready = False
def other_thread():
- self.ready = True
print "thread started"
- time.sleep(5)
+ lock2.release()
+ lock1.acquire()
+ lock1 = thread.allocate_lock()
+ lock2 = thread.allocate_lock()
+ lock1.acquire()
+ lock2.acquire()
thread.start_new_thread(other_thread, ())
def f():
- for i in range(100):
- if self.ready: break
- time.sleep(0.1)
+ lock2.acquire()
return sys._current_frames()
frames = f()
+ lock1.release()
thisframe = frames.pop(thread_id)
assert thisframe.f_code.co_name == 'f'
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit