[Python-checkins] CVS: python/dist/src/Doc/lib libwarnings.tex,1.7,1.8
Walter D?rwald
doerwalter@users.sourceforge.net
Thu, 21 Mar 2002 02:38:42 -0800
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv27021/Doc/lib
Modified Files:
libwarnings.tex
Log Message:
[Apply SF patch #504943]
This patch makes it possible to pass Warning instances as the first
argument to warnings.warn. In this case the category argument
will be ignored. The message text used will be str(warninginstance).
Index: libwarnings.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libwarnings.tex,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** libwarnings.tex 12 Mar 2002 19:49:31 -0000 1.7
--- libwarnings.tex 21 Mar 2002 10:38:40 -0000 1.8
***************
*** 146,150 ****
Issue a warning, or maybe ignore it or raise an exception. The
\var{category} argument, if given, must be a warning category class
! (see above); it defaults to \exception{UserWarning}. This function
raises an exception if the particular warning issued is changed
into an error by the warnings filter see above. The \var{stacklevel}
--- 146,153 ----
Issue a warning, or maybe ignore it or raise an exception. The
\var{category} argument, if given, must be a warning category class
! (see above); it defaults to \exception{UserWarning}. Alternatively
! \var{message} can be a \exception{Warning} instance, in which case
! \var{category} will be ignore and \code{message.__class__} will be used.
! In this case the message text will be \code{str(message)}. This function
raises an exception if the particular warning issued is changed
into an error by the warnings filter see above. The \var{stacklevel}
***************
*** 170,173 ****
--- 173,179 ----
the module). The module name defaults to the filename with \code{.py}
stripped; if no registry is passed, the warning is never suppressed.
+ \var{message} must be a string and \var{category} a subclass of
+ \exception{Warning} or \var{message} may be a \exception{Warning} instance,
+ in which case \var{category} will be ignored.
\end{funcdesc}