[Python-checkins] python/dist/src/Doc/ext newtypes.tex,1.30,1.31
fdrake@users.sourceforge.net
fdrake@users.sourceforge.net
Tue, 01 Jul 2003 09:17:52 -0700
Update of /cvsroot/python/python/dist/src/Doc/ext
In directory sc8-pr-cvs1:/tmp/cvs-serv11977
Modified Files:
newtypes.tex
Log Message:
normalize markup for consistency
Index: newtypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** newtypes.tex 28 Jun 2003 15:22:16 -0000 1.30
--- newtypes.tex 1 Jul 2003 16:17:50 -0000 1.31
***************
*** 159,163 ****
This is so that Python knows how much memory to allocate when you call
! \cfunction{PyObject_New}.
\begin{verbatim}
--- 159,163 ----
This is so that Python knows how much memory to allocate when you call
! \cfunction{PyObject_New()}.
\begin{verbatim}
***************
*** 193,197 ****
\member{tp_new} implementation. In this case, we can just use the
default implementation provided by the API function
! \cfunction{PyType_GenericNew}. We'd like to just assign this to the
\member{tp_new} slot, but we can't, for portability sake, On some
platforms or compilers, we can't statically initialize a structure
--- 193,197 ----
\member{tp_new} implementation. In this case, we can just use the
default implementation provided by the API function
! \cfunction{PyType_GenericNew()}. We'd like to just assign this to the
\member{tp_new} slot, but we can't, for portability sake, On some
platforms or compilers, we can't statically initialize a structure
***************
*** 210,214 ****
Everything else in the file should be familiar, except for some code
! in \cfunction{initnoddy}:
\begin{verbatim}
--- 210,214 ----
Everything else in the file should be familiar, except for some code
! in \cfunction{initnoddy()}:
\begin{verbatim}
***************
*** 316,320 ****
This method decrements the reference counts of the two Python
! attributes. We use \cfunction{Py_XDECREF} here because the
\member{first} and \member{last} members could be \NULL. It then
calls the \member{tp_free} member of the object's type to free the
--- 316,320 ----
This method decrements the reference counts of the two Python
! attributes. We use \cfunction{Py_XDECREF()} here because the
\member{first} and \member{last} members could be \NULL. It then
calls the \member{tp_free} member of the object's type to free the
***************
*** 363,374 ****
The new member is responsible for creating (as opposed to
initializing) objects of the type. It is exposed in Python as the
! \method{__new__} method. See the paper titled ``Unifying types and
! classes in Python'' for a detailed discussion of the \method{__new__}
method. One reason to implement a new method is to assure the initial
values of instance variables. In this case, we use the new method to
make sure that the initial values of the members \member{first} and
\member{last} are not \NULL. If we didn't care whether the initial
! values were \NULL, we could have used \cfunction{PyType_GenericNew} as
! our new method, as we did before. \cfunction{PyType_GenericNew}
initializes all of the instance variable members to NULLs.
--- 363,374 ----
The new member is responsible for creating (as opposed to
initializing) objects of the type. It is exposed in Python as the
! \method{__new__()} method. See the paper titled ``Unifying types and
! classes in Python'' for a detailed discussion of the \method{__new__()}
method. One reason to implement a new method is to assure the initial
values of instance variables. In this case, we use the new method to
make sure that the initial values of the members \member{first} and
\member{last} are not \NULL. If we didn't care whether the initial
! values were \NULL, we could have used \cfunction{PyType_GenericNew()} as
! our new method, as we did before. \cfunction{PyType_GenericNew()}
initializes all of the instance variable members to NULLs.
***************
*** 423,427 ****
The \member{tp_init} slot is exposed in Python as the
! \method{__init__} method. It is used to initialize an object after
it's created. Unlike the new method, we can't guarantee that the
initializer is called. The initializer isn't called when unpickling
--- 423,427 ----
The \member{tp_init} slot is exposed in Python as the
! \method{__init__()} method. It is used to initialize an object after
it's created. Unlike the new method, we can't guarantee that the
initializer is called. The initializer isn't called when unpickling
***************
*** 551,556 ****
\end{verbatim}
! We rename \cfunction{initnoddy} to \cfunction{initnoddy2}
! and update the module name passed to \cfunction{Py_InitModule3}.
Finally, we update our \file{setup.py} file to build the new module:
--- 551,556 ----
\end{verbatim}
! We rename \cfunction{initnoddy()} to \cfunction{initnoddy2()}
! and update the module name passed to \cfunction{Py_InitModule3()}.
Finally, we update our \file{setup.py} file to build the new module:
***************
*** 662,666 ****
\member{last} members are never NULL so we can remove checks for \NULL
values in almost all cases. This means that most of the
! \cfunction{Py_XDECREF} calls can be converted to \cfunction{Py_DECREF}
calls. The only place we can't change these calls is in the
deallocator, where there is the possibility that the initialization of
--- 662,666 ----
\member{last} members are never NULL so we can remove checks for \NULL
values in almost all cases. This means that most of the
! \cfunction{Py_XDECREF()} calls can be converted to \cfunction{Py_DECREF()}
calls. The only place we can't change these calls is in the
deallocator, where there is the possibility that the initialization of
***************
*** 724,729 ****
For each subobject that can participate in cycles, we need to call the
! \cfunction{visit} function, which is passed to the traversal method.
! The \cfunction{visit} function takes as arguments the subobject and
the extra argument \var{arg} passed to the traversal method.
--- 724,729 ----
For each subobject that can participate in cycles, we need to call the
! \cfunction{visit()} function, which is passed to the traversal method.
! The \cfunction{visit()} function takes as arguments the subobject and
the extra argument \var{arg} passed to the traversal method.
***************
*** 752,756 ****
\end{verbatim}
! Finally, we add the \constant{Py_TPFLAGS_HAVE_GC} flag to the class flags:
\begin{verbatim}
--- 752,757 ----
\end{verbatim}
! Finally, we add the \constant{Py_TPFLAGS_HAVE_GC} flag to the class
! flags:
\begin{verbatim}