Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Mar 17, 2025

Conversation

miss-islington
Copy link
Contributor

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

  • 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