[pypy-svn] r56208 - in pypy/dist/pypy/module/sys: . test
arigo at codespeak.net
arigo at codespeak.net
Tue Jul 1 19:29:17 CEST 2008
Author: arigo
Date: Tue Jul 1 19:29:17 2008
New Revision: 56208
Modified:
pypy/dist/pypy/module/sys/test/test_sysmodule.py
pypy/dist/pypy/module/sys/vm.py
Log:
This is really just a workaround for CPython tests,
but I try to provide some (very vague) justification.
Modified: pypy/dist/pypy/module/sys/test/test_sysmodule.py
==============================================================================
--- pypy/dist/pypy/module/sys/test/test_sysmodule.py (original)
+++ pypy/dist/pypy/module/sys/test/test_sysmodule.py Tue Jul 1 19:29:17 2008
@@ -263,7 +263,7 @@
def test_setcheckinterval(self):
raises(TypeError, sys.setcheckinterval)
orig = sys.getcheckinterval()
- for n in 1, 100, 120, orig: # orig last to restore starting state
+ for n in 0, 100, 120, orig: # orig last to restore starting state
sys.setcheckinterval(n)
assert sys.getcheckinterval() == n
Modified: pypy/dist/pypy/module/sys/vm.py
==============================================================================
--- pypy/dist/pypy/module/sys/vm.py (original)
+++ pypy/dist/pypy/module/sys/vm.py Tue Jul 1 19:29:17 2008
@@ -66,7 +66,15 @@
def getcheckinterval(space):
"""Return the current check interval; see setcheckinterval()."""
- return space.wrap(space.sys.checkinterval)
+ # xxx to make tests and possibly some obscure apps happy, if the
+ # checkinterval is set to the minimum possible value (which is 1) we
+ # return 0. The idea is that according to the CPython docs, <= 0
+ # means "check every virtual instruction, maximizing responsiveness
+ # as well as overhead".
+ result = space.sys.checkinterval
+ if result <= 1:
+ result = 0
+ return space.wrap(result)
def exc_info(space):
"""Return the (type, value, traceback) of the most recent exception
More information about the Pypy-commit
mailing list