[Python-checkins] CVS: python/dist/src/Doc/lib libsys.tex,1.44,1.45

Ka-Ping Yee ping@users.sourceforge.net
Thu, 22 Mar 2001 18:46:54 -0800


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

Modified Files:
	libsys.tex 
Log Message:
Add sys.excepthook.
Update docstring and library reference section on 'sys' module.
New API PyErr_Display, just for displaying errors, called by excepthook.
Uncaught exceptions now call sys.excepthook; if that fails, we fall back
    to calling PyErr_Display directly.
Also comes with sys.__excepthook__ and sys.__displayhook__.


Index: libsys.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsys.tex,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -r1.44 -r1.45
*** libsys.tex	2001/01/11 05:41:27	1.44
--- libsys.tex	2001/03/23 02:46:52	1.45
***************
*** 49,56 ****
  \code{sys.stdout}, and saves it in \code{__builtin__._}.
  
! This function is called when an expression is entered at the prompt
! of an interactive Python session. It exists mainly so it can be
! overridden.
  \end{funcdesc}
  
  \begin{funcdesc}{exc_info}{}
--- 49,77 ----
  \code{sys.stdout}, and saves it in \code{__builtin__._}.
  
! \code{sys.displayhook} is called on the result of evaluating
! an expression entered in an interactive Python session.
! The display of these values can be customized by assigning
! another function to \code{sys.displayhook}.
  \end{funcdesc}
+ 
+ \begin{funcdesc}{excepthook}{\var{type}, \var{value}, \var{traceback}}
+ This function prints out a given traceback and exception to
+ \code{sys.stderr}.
+ 
+ \code{sys.excepthook} is called when an exception is raised
+ and uncaught.  In an interactive session this happens just before
+ control is returned to the prompt; in a Python program this happens
+ just before the program exits.
+ The handling of such top-level exceptions can be customized by
+ assigning another function to \code{sys.excepthook}.
+ \end{funcdesc}
+ 
+ \begin{datadesc}{__displayhook__}
+ \dataline{__excepthook__}
+ These objects contain the original values of \code{displayhook}
+ and \code{excepthook} at the start of the program.  They are saved
+ so that \code{displayhook} and \code{excepthook} can be restored
+ in case they happen to get replaced with broken objects.
+ \end{datadesc}
  
  \begin{funcdesc}{exc_info}{}