Skip to content

[3.12] gh-129675: Update documentation for tp_basicsize & tp_itemsize (GH-129850)#131078

Merged
encukou merged 1 commit into
python:3.12from
miss-islington:backport-ad0f618-3.12
Mar 17, 2025
Merged

[3.12] gh-129675: Update documentation for tp_basicsize & tp_itemsize (GH-129850)#131078
encukou merged 1 commit into
python:3.12from
miss-islington:backport-ad0f618-3.12

Conversation

@miss-islington

@miss-islington miss-islington commented Mar 11, 2025

Copy link
Copy Markdown
Contributor
  • 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
    (cherry picked from commit ad0f618)

Co-authored-by: Petr Viktorin encukou@gmail.com


📚 Documentation preview 📚: https://cpython-previews--131078.org.readthedocs.build/

…ythonGH-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
(cherry picked from commit ad0f618)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news topic-C-API

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants