Skip to content

[Documentation] Clarify Reference Counting Semantics for Internal and Public API Functions #141037

@wr-web

Description

@wr-web

Description

We have identified several functions where the reference counting semantics are not clearly documented.

Internal functions (PyAPI_FUNC) with undocumented semantics:

  • Return new reference:
    • _PyXI_ApplyCapturedException
    • _PyXI_ApplyError
    • _Py_GetExecutor
    • _PyTime_AsLong
  • Return borrowed reference:
    • _PyDict_GetItemStringWithError
    • _PySys_GetAttr

Public API functions lacking clear semantic tags:

  • Return new reference:
    • PyAsyncGen_New
    • PyComplex_FromCComplex

Could these semantics be officially documented (e.g., in refcount.dat or the source code) to aid in analysis?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions