コード例 #1
0
ファイル: test_standalone.py プロジェクト: ieure/pypy
 def entry_point(argv):
     _stack_set_length_fraction(0.1)
     try:
         return f(1)
     except StackOverflow:
         glob.n = 0
     _stack_set_length_fraction(float(argv[1]))
     try:
         return f(1)
     except StackOverflow:
         print glob.n
         return 0
コード例 #2
0
ファイル: test_standalone.py プロジェクト: njues/Sypy
 def entry_point(argv):
     _stack_set_length_fraction(0.1)
     try:
         return f(1)
     except StackOverflow:
         glob.n = 0
     _stack_set_length_fraction(float(argv[1]))
     try:
         return f(1)
     except StackOverflow:
         print glob.n
         return 0
コード例 #3
0
ファイル: vm.py プロジェクト: ieure/pypy
def setrecursionlimit(space, w_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
reserves 768KB of stack space, which should suffice (on Linux,
depending on the compiler settings) for ~1400 calls.  Setting the
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"))
    space.sys.recursionlimit = new_limit
    _stack_set_length_fraction(new_limit * 0.001)
コード例 #4
0
ファイル: vm.py プロジェクト: nipengadmaster/pypy
def setrecursionlimit(space, w_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
reserves 768KB of stack space, which should suffice (on Linux,
depending on the compiler settings) for ~1400 calls.  Setting the
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"))
    space.sys.recursionlimit = new_limit
    if space.config.translation.type_system == 'lltype':
        _stack_set_length_fraction(new_limit * 0.001)