Skip to content

PyObject_CallFinalizerFromDealloc is undocumented #75459

Closed

Description

@pv
mannequin
BPO 31276
Nosy @pv

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2017-08-25.14:26:48.286>
labels = ['3.7', 'docs']
title = 'PyObject_CallFinalizerFromDealloc is undocumented'
updated_at = <Date 2017-08-25.14:26:48.286>
user = 'https://github.com/pv'

bugs.python.org fields:

activity = <Date 2017-08-25.14:26:48.286>
actor = 'pv'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2017-08-25.14:26:48.286>
creator = 'pv'
dependencies = []
files = []
hgrepos = []
issue_num = 31276
keywords = []
message_count = 1.0
messages = ['300842']
nosy_count = 2.0
nosy_names = ['pv', 'docs@python']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue31276'
versions = ['Python 3.7']

Linked PRs

Activity

  1. pv commented on Aug 25, 2017

    pvmannequin
    MannequinAuthor

    It's unclear if PyObject_CallFinalizerFromDealloc is a public function
    or not. It is not documented, but it seems there's no other way to
    ensure that tp_finalize runs, at least for objects without
    Py_TPFLAGS_HAVE_GC.

    In the documentation of tp_finalize (https://docs.python.org/3/c-api/typeobj.html?highlight=tp_finalize#c.PyTypeObject.tp_finalize)
    there is the sentence:

    """It is called either from the garbage collector (if the instance is
    part of an isolated reference cycle) or just before the object is
    deallocated."""

    However, it appears it is necessary to call it explicitly from any
    user-provided tp_dealloc. Indeed, there are several calls to
    PyObject_CallFinalizerFromDealloc in cpython/Modules/* e.g. in
    posixmodule.c:ScandirIterator_dealloc

  2. added
    docsDocumentation in the Doc dir
    on Aug 25, 2017
  3. transferred this issue fromon Apr 10, 2022
  4. added 9 commits that reference this issue on Oct 25, 2024
  5. added a commit that references this issue on May 20, 2025
  6. 5 remaining items

  7. added a commit that references this issue on May 20, 2025
  8. added a commit that references this issue on May 20, 2025
  9. added a commit that references this issue on Jul 12, 2025
  10. added a commit that references this issue on Aug 4, 2025
  11. self-assigned this
    on Jan 18, 2026
  12. added a commit that references this issue on Jan 18, 2026
  13. removed their assignment
    on Jan 18, 2026
  14. added a commit that references this issue on Jan 19, 2026
  15. added a commit that references this issue on Jan 19, 2026
  16. added a commit that references this issue on Jan 20, 2026
  17. added a commit that references this issue on Feb 15, 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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions