]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-129675: Update documentation for tp_basicsize & tp_itemsize (#129850)
authorPetr Viktorin <encukou@gmail.com>
Tue, 11 Mar 2025 10:21:18 +0000 (11:21 +0100)
committerGitHub <noreply@github.com>
Tue, 11 Mar 2025 10:21:18 +0000 (11:21 +0100)
commitad0f618ab3eb1f26f8830a863aaf7bb70835c00d
treeb32ac2538aa51de246074517f3130748abc37d16
parentfaadb446d9d26827e23dc1cf68ffb6218bc70d32
gh-129675: Update documentation for tp_basicsize & tp_itemsize (#129850)

* Update documentation for tp_basicsize & tp_itemsize

- Add alignment requirement
- Mention that ob_size is unreliable if you don't control it
- Add some links for context
- basicsize should include the base type in generaly not just PyObject

This adds a “by-the-way” link to `PyObject_New`, which shouldn't be
used for GC types. In order to be comfortable linking to it, I also
add a link to `PyObject_GC_New` from its docs. And the same for
`*Var` variants, while I'm here.

* Strongly suggest Py_SIZE & Py_SET_SIZE
Doc/c-api/allocation.rst
Doc/c-api/type.rst
Doc/c-api/typeobj.rst