diff options
author | Guido van Rossum <guido@python.org> | 2002-05-31 21:00:18 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-05-31 21:00:18 (GMT) |
commit | 9788384d02a21982bbbdfc97dc95d5502bad1f42 (patch) | |
tree | e5ad6f7febbe53e2625786c2d8c136facc396335 | |
parent | ebb41907098acab04f0ed2165dca63c2b2264ced (diff) | |
download | cpython-9788384d02a21982bbbdfc97dc95d5502bad1f42.zip cpython-9788384d02a21982bbbdfc97dc95d5502bad1f42.tar.gz cpython-9788384d02a21982bbbdfc97dc95d5502bad1f42.tar.bz2 |
Explain that tp_basicsize must provide alignment for the items.
-rw-r--r-- | Doc/api/newtypes.tex | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/api/newtypes.tex b/Doc/api/newtypes.tex index 8d862db..69c49f2 100644 --- a/Doc/api/newtypes.tex +++ b/Doc/api/newtypes.tex @@ -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} |