diff Doc/lib/libsys.tex @ 14308:b8b3f76ffd51 legacy-trunk

add user-modifiable recursion_limit ceval.c: define recurion_limit (static), default value is 2500 define Py_GetRecursionLimit and Py_SetRecursionLimit raise RuntimeError if limit is exceeded PC/config.h: remove plat-specific definition sysmodule.c: add sys.(get|set)recursionlimit
author Jeremy Hylton <jeremy@alum.mit.edu>
date Thu, 31 Aug 2000 19:23:01 +0000
parents eb9a36163a9e
children 97651f28b004
line wrap: on
line diff
--- a/Doc/lib/libsys.tex	Thu Aug 31 19:04:07 2000 +0000
+++ b/Doc/lib/libsys.tex	Thu Aug 31 19:23:01 2000 +0000
@@ -148,6 +148,13 @@
 (temporary) reference as an argument to \function{getrefcount()}.
 \end{funcdesc}
 
+\begin{funcdesc}{getrecursionlimit}{}
+Return the current value of the recursion limit, the maximum depth of
+the Python interpreter stack.  This limit prevents infinite recursion
+from causing an overflow of the C stack and crashing Python.  It can
+be set by \function{setrecursionlimit}.
+\end{funcdesc}
+
 \begin{datadesc}{hexversion}
 The version number encoded as a single integer.  This is guaranteed to
 increase with each version, including proper support for
@@ -275,6 +282,17 @@
 \index{profile function}
 \index{profiler}
 
+\begin{funcdesc}{setrecursionlimit}{limit}
+Set the maximum depth of the Python interpreter stack to \var{limit}.
+This limit prevents infinite recursion from causing an overflow of the
+C stack and crashing Python.  
+
+The highest possible limit is platform-dependent.  A user may need to
+set the limit higher when she has a program that requires deep
+recursion and a platform that supports a higher limit.  This should be
+done with care, because a too-high limit can lead to a crash.
+\edn{funcdesc}
+
 \begin{funcdesc}{settrace}{tracefunc}
   Set the system's trace function, which allows you to implement a
   Python source code debugger in Python.  See section ``How It Works''