Armin Rigo avatar Armin Rigo committed 31057f1

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

Comments (0)

Files changed (2)

pypy/module/sys/test/test_sysmodule.py

         sys.setrecursionlimit(10000)
         assert sys.getrecursionlimit() == 10000
         sys.setrecursionlimit(oldlimit)
+        raises(OverflowError, sys.setrecursionlimit, 1<<31)
 
     def test_getwindowsversion(self):
         import sys

pypy/module/sys/vm.py

     f.mark_as_escaped()
     return space.wrap(f)
 
-def setrecursionlimit(space, w_new_limit):
+@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
 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"))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.