[pypy-commit] pypy py3k: pypy3 still adheres to the oldgil interface

pjenvey pypy.commits at gmail.com
Sat May 14 14:27:46 EDT 2016


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r84435:09400436a7f0
Date: 2016-05-14 11:25 -0700
http://bitbucket.org/pypy/pypy/changeset/09400436a7f0/

Log:	pypy3 still adheres to the oldgil interface

diff --git a/lib-python/3/test/test_threading.py b/lib-python/3/test/test_threading.py
--- a/lib-python/3/test/test_threading.py
+++ b/lib-python/3/test/test_threading.py
@@ -462,11 +462,16 @@
     def test_is_alive_after_fork(self):
         # Try hard to trigger #18418: is_alive() could sometimes be True on
         # threads that vanished after a fork.
-        old_interval = sys.getswitchinterval()
-        self.addCleanup(sys.setswitchinterval, old_interval)
+        newgil = hasattr(sys, 'getswitchinterval')
+        if newgil:
+            geti, seti = sys.getswitchinterval, sys.setswitchinterval
+        else:
+            geti, seti = sys.getcheckinterval, sys.setcheckinterval
+        old_interval = geti()
+        self.addCleanup(seti, old_interval)
 
         # Make the bug more likely to manifest.
-        sys.setswitchinterval(1e-6)
+        seti(1e-6 if newgil else 1)
 
         for i in range(20):
             t = threading.Thread(target=lambda: None)


More information about the pypy-commit mailing list