Skip to content

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

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

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--131079.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>
@bedevere-app bedevere-app bot added docs Documentation in the Doc dir awaiting review labels Mar 11, 2025
@github-project-automation github-project-automation bot moved this to Todo in Docs PRs Mar 11, 2025
@encukou encukou merged commit 6ceb8fc into python:3.13 Mar 17, 2025
29 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Mar 17, 2025
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