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
diff --git a/Doc/lib/libsys.tex b/Doc/lib/libsys.tex
index bbea623..ac28e6f 100644
--- a/Doc/lib/libsys.tex
+++ b/Doc/lib/libsys.tex
@@ -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''