Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > by-pkgid > 0b7eb7009605a11593fbe388d7fbee61 > files > 342

python-docs-2.2-9.1mdk.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>3.11.4 The interpreter stack </title>
<META NAME="description" CONTENT="3.11.4 The interpreter stack ">
<META NAME="keywords" CONTENT="lib">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=">
<link rel="STYLESHEET" href="lib.css">
<link rel="first" href="lib.html">
<link rel="contents" href="contents.html" title="Contents">
<link rel="index" href="genindex.html" title="Index">
<LINK REL="previous" href="inspect-classes-functions.html">
<LINK REL="up" href="module-inspect.html">
<LINK REL="next" href="module-traceback.html">
</head>
<body>
<DIV CLASS="navigation">
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="inspect-classes-functions.html"><img src="../icons/previous.gif"
  border="0" height="32"
  alt="Previous Page" width="32"></A></td>
<td><A href="module-inspect.html"><img src="../icons/up.gif"
  border="0" height="32"
  alt="Up One Level" width="32"></A></td>
<td><A href="module-traceback.html"><img src="../icons/next.gif"
  border="0" height="32"
  alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html"><img src="../icons/contents.gif"
  border="0" height="32"
  alt="Contents" width="32"></A></td>
<td><a href="modindex.html" title="Module Index"><img src="../icons/modules.gif"
  border="0" height="32"
  alt="Module Index" width="32"></a></td>
<td><A href="genindex.html"><img src="../icons/index.gif"
  border="0" height="32"
  alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="inspect-classes-functions.html">3.11.3 Classes and functions</A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-inspect.html">3.11 inspect  </A>
<b class="navlabel">Next:</b> <a class="sectref" href="module-traceback.html">3.12 traceback  </A>
<br><hr>
</DIV>
<!--End of Navigation Panel-->

<H2><A NAME="SECTION0051140000000000000000">&nbsp;</A>
<BR>
3.11.4 The interpreter stack
            
</H2>

<P>
When the following functions return ``frame records,'' each record
is a tuple of six items: the frame object, the filename,
the line number of the current line, the function name, a list of
lines of context from the source code, and the index of the current
line within that list.
The optional <var>context</var> argument specifies the number of lines of
context to return, which are centered around the current line.

<P>
<span class="warning"><b class="label">Warning:</b>
Keeping references to frame objects, as found in
the first element of the frame records these functions return, can
cause your program to create reference cycles.  Once a reference cycle
has been created, the lifespan of all objects which can be accessed
from the objects which form the cycle can become much longer even if
Python's optional cycle detector is enabled.  If such cycles must be
created, it is important to ensure they are explicitly broken to avoid
the delayed destruction of objects and increased memory consumption
which occurs.</span>

<P>
<dl><dt><b><a name="l2h-485"><tt class="function">getframeinfo</tt></a></b>(<var>frame</var><big>[</big><var>, context</var><big>]</big>)
<dd>
  Get information about a frame or traceback object.  A 5-tuple
  is returned, the last five elements of the frame's frame record.
  The optional second argument specifies the number of lines of context
  to return, which are centered around the current line.
</dl>

<P>
<dl><dt><b><a name="l2h-486"><tt class="function">getouterframes</tt></a></b>(<var>frame</var><big>[</big><var>, context</var><big>]</big>)
<dd>
  Get a list of frame records for a frame and all higher (calling)
  frames.
</dl>

<P>
<dl><dt><b><a name="l2h-487"><tt class="function">getinnerframes</tt></a></b>(<var>traceback</var><big>[</big><var>, context</var><big>]</big>)
<dd>
  Get a list of frame records for a traceback's frame and all lower
  frames.
</dl>

<P>
<dl><dt><b><a name="l2h-488"><tt class="function">currentframe</tt></a></b>()
<dd>
  Return the frame object for the caller's stack frame.
</dl>

<P>
<dl><dt><b><a name="l2h-489"><tt class="function">stack</tt></a></b>(<big>[</big><var>context</var><big>]</big>)
<dd>
  Return a list of frame records for the stack above the caller's
  frame.
</dl>

<P>
<dl><dt><b><a name="l2h-490"><tt class="function">trace</tt></a></b>(<big>[</big><var>context</var><big>]</big>)
<dd>
  Return a list of frame records for the stack below the current
  exception.
</dl>

<DIV CLASS="navigation">
<p><hr>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="inspect-classes-functions.html"><img src="../icons/previous.gif"
  border="0" height="32"
  alt="Previous Page" width="32"></A></td>
<td><A href="module-inspect.html"><img src="../icons/up.gif"
  border="0" height="32"
  alt="Up One Level" width="32"></A></td>
<td><A href="module-traceback.html"><img src="../icons/next.gif"
  border="0" height="32"
  alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html"><img src="../icons/contents.gif"
  border="0" height="32"
  alt="Contents" width="32"></A></td>
<td><a href="modindex.html" title="Module Index"><img src="../icons/modules.gif"
  border="0" height="32"
  alt="Module Index" width="32"></a></td>
<td><A href="genindex.html"><img src="../icons/index.gif"
  border="0" height="32"
  alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="inspect-classes-functions.html">3.11.3 Classes and functions</A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-inspect.html">3.11 inspect  </A>
<b class="navlabel">Next:</b> <a class="sectref" href="module-traceback.html">3.12 traceback  </A>
<hr>
<span class="release-info">Release 2.2, documentation updated on December 21, 2001.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>