[Python-checkins] python/dist/src/Doc/lib libinspect.tex,1.10,1.10.6.1

fdrake@sourceforge.net fdrake@sourceforge.net
Tue, 23 Apr 2002 14:20:47 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv27310/lib

Modified Files:
      Tag: release22-maint
	libinspect.tex 
Log Message:
Add text about circular references caused by storing frames in local
variables.  This closes SF bug #543148.


Index: libinspect.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libinspect.tex,v
retrieving revision 1.10
retrieving revision 1.10.6.1
diff -C2 -d -r1.10 -r1.10.6.1
*** libinspect.tex	7 Dec 2001 23:13:53 -0000	1.10
--- libinspect.tex	23 Apr 2002 21:20:44 -0000	1.10.6.1
***************
*** 322,323 ****
--- 322,339 ----
    exception.
  \end{funcdesc}
+ 
+ Stackframes stored directly or indirectly in local variables can
+ easily cause reference cycles.  Though the cycle detector will catch
+ these, destruction of the frames (and local variables) can be made
+ deterministic by removing the cycle in a \keyword{finally} clause.
+ This is also important if the cycle detector was disabled when Python
+ was compiled or using \function{gc.disable()}.  For example:
+ 
+ \begin{verbatim}
+ def handle_stackframe_without_leak():
+     frame = inspect.currentframe()
+     try:
+         # do something with the frame
+     finally:
+         del frame
+ \end{verbatim}