[pypy-commit] pypy stdlib-2.7.6: try to fix this test from occasionally hanging untranslated

bdkearns noreply at buildbot.pypy.org
Wed Mar 5 05:39:06 CET 2014


Author: Brian Kearns <bdkearns at gmail.com>
Branch: stdlib-2.7.6
Changeset: r69702:114c53c1bf8d
Date: 2014-03-04 23:13 -0500
http://bitbucket.org/pypy/pypy/changeset/114c53c1bf8d/

Log:	try to fix this test from occasionally hanging untranslated

diff --git a/pypy/module/select/test/test_select.py b/pypy/module/select/test/test_select.py
--- a/pypy/module/select/test/test_select.py
+++ b/pypy/module/select/test/test_select.py
@@ -258,7 +258,7 @@
         return FileAsSocket(s1), FileAsSocket(s2)
 
     def test_poll_threaded(self):
-        import os, select, threading, time
+        import os, select, thread, time
         if not hasattr(select, 'poll'):
             skip("no select.poll() on this platform")
         r, w = os.pipe()
@@ -268,11 +268,9 @@
             for fd in rfds:
                 pollster.register(fd, select.POLLIN)
 
-            t = threading.Thread(target=pollster.poll)
-            t.start()
+            t = thread.start_new_thread(pollster.poll, ())
             try:
-                for i in range(5):
-                    time.sleep(0.1); print '',  # print to release GIL untranslated
+                time.sleep(0.1); print '',  # print to release GIL untranslated
                 # trigger ufds array reallocation
                 for fd in rfds:
                     pollster.unregister(fd)
@@ -282,7 +280,7 @@
             finally:
                 # and make the call to poll() from the thread return
                 os.write(w, b'spam')
-                t.join()
+                time.sleep(0.1); print '',  # print to release GIL untranslated
         finally:
             os.close(r)
             os.close(w)


More information about the pypy-commit mailing list