diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-08-31 19:23:01 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-08-31 19:23:01 (GMT) |
commit | ee5adfbae6df9a4ae8d73bccc4f3a55b7f382d11 (patch) | |
tree | ecbac10d7a319d2d655ad1ddffcfdb9b75c9c70b /Doc | |
parent | c88b99ce060e37a9098708483b7e3c8b5db87fbd (diff) | |
download | cpython-ee5adfbae6df9a4ae8d73bccc4f3a55b7f382d11.zip cpython-ee5adfbae6df9a4ae8d73bccc4f3a55b7f382d11.tar.gz cpython-ee5adfbae6df9a4ae8d73bccc4f3a55b7f382d11.tar.bz2 |
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
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libsys.tex | 18 |
1 files changed, 18 insertions, 0 deletions
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 @@ generally one higher than you might expect, because it includes the (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 @@ maximizing responsiveness as well as overhead. \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'' |