[Python-checkins] CVS: python/dist/src/Doc/ext ext.tex,1.91,1.92

Fred L. Drake fdrake@users.sourceforge.net
2001年3月02日 10:15:14 -0800


Update of /cvsroot/python/python/dist/src/Doc/ext
In directory usw-pr-cvs1:/tmp/cvs-serv19724/ext
Modified Files:
	ext.tex 
Log Message:
There is no longer a -X option to the interpreter, so remove the comments
on how PyErr_NewException() behaves in that case.
Clarify why an owned reference is kept in an extension module's
variable that refers to the result of PyErr_NewException(); one reader
thought that was a leak.
Clean up some tabs and simplify some markup.
Index: ext.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/ext/ext.tex,v
retrieving revision 1.91
retrieving revision 1.92
diff -C2 -r1.91 -r1.92
*** ext.tex	2001年02月19日 19:22:00	1.91
--- ext.tex	2001年03月02日 18:15:11	1.92
***************
*** 278,290 ****
 Note that the Python name for the exception object is
 \exception{spam.error}. The \cfunction{PyErr_NewException()} function
! may create either a string or class, depending on whether the
! \programopt{-X} flag was passed to the interpreter. If
! \programopt{-X} was used, \cdata{SpamError} will be a string object,
! otherwise it will be a class object with the base class being
! \exception{Exception}, described in the
 \citetitle[../lib/lib.html]{Python Library Reference} under ``Built-in
 Exceptions.''
 
 
 \section{Back to the Example
 \label{backToExample}}
--- 278,295 ----
 Note that the Python name for the exception object is
 \exception{spam.error}. The \cfunction{PyErr_NewException()} function
! may create a class with the base class being \exception{Exception}
! (unless another class is passed in instead of \NULL), described in the
 \citetitle[../lib/lib.html]{Python Library Reference} under ``Built-in
 Exceptions.''
 
+ Note also that the \cdata{SpamError} variable retains a reference to
+ the newly created exception class; this is intentional! Since the
+ exception could be removed from the module by external code, an owned
+ reference to the class is needed to ensure that it will not be
+ discarded, causing \cdata{SpamError} to become a dangling pointer.
+ Should it become a dangling pointer, C code which raises the exception
+ could cause a core dump or other unintended side effects.
 
+ 
 \section{Back to the Example
 \label{backToExample}}
***************
*** 2127,2147 ****
 will implement.
 
- \begin{verbatim}
- 	destructor tp_dealloc;
- \end{verbatim}
- \begin{verbatim}
- 	printfunc tp_print;
- \end{verbatim}
- \begin{verbatim}
- 	getattrfunc tp_getattr;
- \end{verbatim}
- \begin{verbatim}
- 	setattrfunc tp_setattr;
- \end{verbatim}
 \begin{verbatim}
! 	cmpfunc tp_compare;
! \end{verbatim}
! \begin{verbatim}
! 	reprfunc tp_repr;
 \end{verbatim}
 
--- 2132,2142 ----
 will implement.
 
 \begin{verbatim}
! destructor tp_dealloc;
! printfunc tp_print;
! getattrfunc tp_getattr;
! setattrfunc tp_setattr;
! cmpfunc tp_compare;
! reprfunc tp_repr;
 \end{verbatim}
 

AltStyle によって変換されたページ (->オリジナル) /