]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-129675: Update documentation for tp_basicsize & tp_itemsize (GH-129850...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 17 Mar 2025 15:18:26 +0000 (16:18 +0100)
committerGitHub <noreply@github.com>
Mon, 17 Mar 2025 15:18:26 +0000 (16:18 +0100)
commit6ceb8fcfb69bad6c5521db475b7e0a2455432b12
treea07e44d149f4c4dd681bdff2c4b357d6e4a544e1
parent6af54d298d5135302037cdda7a1f5535e48cb1b6
[3.13] gh-129675: Update documentation for tp_basicsize & tp_itemsize (GH-129850) (GH-131079)

- 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
- suggest Py_SIZE & Py_SET_SIZE

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.

(cherry picked from commit ad0f618ab3eb1f26f8830a863aaf7bb70835c00d)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Doc/c-api/allocation.rst
Doc/c-api/type.rst
Doc/c-api/typeobj.rst