Commit 9788384d authored by Guido van Rossum's avatar Guido van Rossum

Explain that tp_basicsize must provide alignment for the items.

parent ebb41907
......@@ -465,6 +465,14 @@ Foo_Type.ob_type = &PyType_Type;
has a non-zero \member{tp_itemsize}, it is generally not safe to set
\member{tp_itemsize} to a different non-zero value in a subtype
(though this depends on the implementation of the base type).
A note about alignment: if the variable items require a particular
alignment, this should be taken care of by the value of
\member{tp_basicsize}. Example: suppose a type implements an array
of \code{double}. \member{tp_itemsize} is \code{sizeof(double)}.
It is the programmer's responsibility that \member{tp_basicsize} is
a multiple of \code{sizeof(double)} (assuming this is the alignment
requirement for \code{double}).
\end{cmemberdesc}
\begin{cmemberdesc}{PyTypeObject}{destructor}{tp_dealloc}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment