[Python-checkins] CVS: python/dist/src/Doc/ref ref3.tex,1.81,1.82
Fred L. Drake
fdrake@users.sourceforge.net
2001年12月14日 14:52:43 -0800
Update of /cvsroot/python/python/dist/src/Doc/ref
In directory usw-pr-cvs1:/tmp/cvs-serv16936/ref
Modified Files:
ref3.tex
Log Message:
Update information about __del__() & reference cycles for CPython.
This partially fixes SF bug #492619.
Fix a typo & use the new notice environment instead of (ab)using the \note
and \warning macros.
Index: ref3.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v
retrieving revision 1.81
retrieving revision 1.82
diff -C2 -d -r1.81 -r1.82
*** ref3.tex 2001年12月11日 21:10:08 1.81
--- ref3.tex 2001年12月14日 22:52:41 1.82
***************
*** 926,930 ****
\stindex{del}
! \strong{Programmer's note:} \samp{del x} doesn't directly call
\code{x.__del__()} --- the former decrements the reference count for
\code{x} by one, and the latter is only called when its reference
--- 926,931 ----
\stindex{del}
! \begin{notice}
! \samp{del x} doesn't directly call
\code{x.__del__()} --- the former decrements the reference count for
\code{x} by one, and the latter is only called when its reference
***************
*** 939,949 ****
\code{sys.last_traceback} keeps the stack frame alive). The first
situation can only be remedied by explicitly breaking the cycles; the
! latter two situations can be resolved by storing None in
! \code{sys.exc_traceback} or \code{sys.last_traceback}.
! \warning{Due to the precarious circumstances under which
\method{__del__()} methods are invoked, exceptions that occur during their
execution are ignored, and a warning is printed to \code{sys.stderr}
! instead. Also, when \method{__del__()} is invoked is response to a module
being deleted (e.g., when execution of the program is done), other
globals referenced by the \method{__del__()} method may already have been
--- 940,959 ----
\code{sys.last_traceback} keeps the stack frame alive). The first
situation can only be remedied by explicitly breaking the cycles; the
! latter two situations can be resolved by storing \code{None} in
! \code{sys.exc_traceback} or \code{sys.last_traceback}. Circular
! references which are garbage are detected when the option cycle
! detector is enabled (it's on by default), but can only be cleaned up
! if there are no Python-level \method{__del__()} methods involved.
! Refer to the documentation for the \ulink{\module{gc}
! module}{../lib/module-gc.html} for more information about how
! \method{__del__()} methods are handled by the cycle detector,
! particularly the description of the \code{garbage} value.
! \end{notice}
! \begin{notice}[warning]
! Due to the precarious circumstances under which
\method{__del__()} methods are invoked, exceptions that occur during their
execution are ignored, and a warning is printed to \code{sys.stderr}
! instead. Also, when \method{__del__()} is invoked in response to a module
being deleted (e.g., when execution of the program is done), other
globals referenced by the \method{__del__()} method may already have been
***************
*** 954,958 ****
other references to such globals exist, this may help in assuring that
imported modules are still available at the time when the
! \method{__del__()} method is called.}
\end{methoddesc}
--- 964,969 ----
other references to such globals exist, this may help in assuring that
imported modules are still available at the time when the
! \method{__del__()} method is called.
! \end{notice}
\end{methoddesc}