[pypy-commit] pypy default: Lower the limit to (1<<31-1) even on 64-bit platforms.

arigo noreply at buildbot.pypy.org
Sat Sep 8 11:52:02 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r57244:31057f18e195
Date: 2012-09-08 11:46 +0200
http://bitbucket.org/pypy/pypy/changeset/31057f18e195/

Log:	Lower the limit to (1<<31-1) even on 64-bit platforms.

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
@@ -359,6 +359,7 @@
         sys.setrecursionlimit(10000)
         assert sys.getrecursionlimit() == 10000
         sys.setrecursionlimit(oldlimit)
+        raises(OverflowError, sys.setrecursionlimit, 1<<31)
 
     def test_getwindowsversion(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
@@ -45,7 +45,8 @@
     f.mark_as_escaped()
     return space.wrap(f)
 
-def setrecursionlimit(space, w_new_limit):
+ at unwrap_spec(new_limit="c_int")
+def setrecursionlimit(space, new_limit):
     """setrecursionlimit() sets the maximum number of nested calls that
 can occur before a RuntimeError is raised.  On PyPy the limit is
 approximative and checked at a lower level.  The default 1000
@@ -54,7 +55,6 @@
 value to N reserves N/1000 times 768KB of stack space.
 """
     from pypy.rlib.rstack import _stack_set_length_fraction
-    new_limit = space.int_w(w_new_limit)
     if new_limit <= 0:
         raise OperationError(space.w_ValueError,
                              space.wrap("recursion limit must be positive"))


More information about the pypy-commit mailing list