()
Install wrappers to always add 30 to the recursion limit.
Install wrappers to always add 30 to the recursion limit.
Install wrappers to always add 30 to the recursion limit .
def install_recursionlimit_wrappers():
    """Install wrappers to always add 30 to the recursion limit."""
    # see: bpo-26806

    @functools.wraps(sys.setrecursionlimit)
    def setrecursionlimit(*args, **kwargs):
        # mimic the original sys.setrecursionlimit()'s input handling
        if kwargs:
            raise TypeError(
                "setrecursionlimit() takes no keyword arguments")
        try:
            limit, = args
        except ValueError:
            raise TypeError(f"setrecursionlimit() takes exactly one "
                            f"argument ({len(args)} given)")
        if not limit > 0:
            raise ValueError(
                "recursion limit must be greater or equal than 1")

        return setrecursionlimit.__wrapped__(limit + RECURSIONLIMIT_DELTA)

    fixdoc(setrecursionlimit, f"""\
            This IDLE wrapper adds {RECURSIONLIMIT_DELTA} to prevent possible
            uninterruptible loops.""")

    @functools.wraps(sys.getrecursionlimit)
    def getrecursionlimit():
        return getrecursionlimit.__wrapped__() - RECURSIONLIMIT_DELTA

    fixdoc(getrecursionlimit, f"""\
            This IDLE wrapper subtracts {RECURSIONLIMIT_DELTA} to compensate
            for the {RECURSIONLIMIT_DELTA} IDLE adds when setting the limit.""")

    # add the delta to the default recursion limit, to compensate
    sys.setrecursionlimit(sys.getrecursionlimit() + RECURSIONLIMIT_DELTA)

    sys.setrecursionlimit = setrecursionlimit
    sys.getrecursionlimit = getrecursionlimit
def install_recursionlimit_wrappers ( ) : # see: bpo-26806 @ functools . wraps ( sys . setrecursionlimit ) def setrecursionlimit ( * args , * * kwargs ) : # mimic the original sys.setrecursionlimit()'s input handling if kwargs : raise TypeError ( "setrecursionlimit() takes no keyword arguments" ) try : limit , = args except ValueError : raise TypeError ( f"setrecursionlimit() takes exactly one " f"argument ({len(args)} given)" ) if not limit > 0 : raise ValueError ( "recursion limit must be greater or equal than 1" ) return setrecursionlimit . __wrapped__ ( limit + RECURSIONLIMIT_DELTA ) fixdoc ( setrecursionlimit , f"""\
            This IDLE wrapper adds {RECURSIONLIMIT_DELTA} to prevent possible
            uninterruptible loops.""" ) @ functools . wraps ( sys . getrecursionlimit ) def getrecursionlimit ( ) : return getrecursionlimit . __wrapped__ ( ) - RECURSIONLIMIT_DELTA fixdoc ( getrecursionlimit , f"""\
            This IDLE wrapper subtracts {RECURSIONLIMIT_DELTA} to compensate
            for the {RECURSIONLIMIT_DELTA} IDLE adds when setting the limit.""" ) # add the delta to the default recursion limit, to compensate sys . setrecursionlimit ( sys . getrecursionlimit ( ) + RECURSIONLIMIT_DELTA ) sys . setrecursionlimit = setrecursionlimit sys . getrecursionlimit = getrecursionlimit