Skip to content

Documentation for PyType_GetDict() Misleading #110891

Closed

Description

@philthompson10

The documentation for PyType_GetDict() is misleading as it says it is a replacement to accessing tp_dict directly. To me this implies it is a drop-in replacement. However the function returns a new reference to the dict and so needs a call to Py_DECREF at some point to avoid a memory leak.

Linked PRs

Activity

  1. ericvsmith commented on Oct 16, 2023

    @ericvsmith
    Member

    I don't think the documentation is misleading: https://docs.python.org/3/c-api/type.html#c.PyType_GetDict doesn't say it's a drop-in replacement.

    What changes would you propose making?

  2. philthompson10 commented on Oct 17, 2023

    @philthompson10
    Author
  3. added a commit that references this issue on Nov 16, 2026
  4. added 2 commits that reference this issue on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions