Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r88928:96c74a5d5b0a
Date: 2016-12-07 10:24 +0100
http://bitbucket.org/pypy/pypy/changeset/96c74a5d5b0a/

Log:    test and fix

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
@@ -440,6 +440,7 @@
         for n in 1e-6, 0.1, orig: # orig last to restore starting state
             sys.setswitchinterval(n)
             assert sys.getswitchinterval() == n
+        raises(ValueError, sys.setswitchinterval, 0.0)
 
     def test_recursionlimit(self):
         import sys
diff --git a/pypy/module/sys/vm.py b/pypy/module/sys/vm.py
--- a/pypy/module/sys/vm.py
+++ b/pypy/module/sys/vm.py
@@ -101,6 +101,9 @@
     # The scaling factor is chosen so that with the default
     # checkinterval value of 10000, it corresponds to 0.005, which is
     # the default value of the switchinterval in CPython 3.5
+    if interval <= 0.0:
+        raise oefmt(space.w_ValueError,
+                    "switch interval must be strictly positive")
     space.actionflag.setcheckinterval(int(interval * 2000000.0))
 
 def getswitchinterval(space):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to