python / python/cpython

Weakref callbacks running before finalizers in GC collection

Open
#84,492 17 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3.7 (EOL) 3.8 (EOL) 3.9 (EOL) interpreter-core type-bug
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

BPO 40312
Nosy @tim-one, @pablogsal, @a-feld
Files
  • 0001-Run-finalizers-before-invoking-weakref-callbacks.patch
  • 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 2020-04-17.19:52:40.901>
    labels = ['interpreter-core', '3.8', 'type-bug', '3.7', '3.9']
    title = 'Weakref callbacks running before finalizers in GC collection'
    updated_at = <Date 2020-04-20.21:54:30.265>
    user = 'https://github.com/a-feld'
    

    bugs.python.org fields:

    activity = <Date 2020-04-20.21:54:30.265>
    actor = 'tim.peters'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Interpreter Core']
    creation = <Date 2020-04-17.19:52:40.901>
    creator = 'a-feld'
    dependencies = []
    files = ['49076']
    hgrepos = []
    issue_num = 40312
    keywords = ['patch']
    message_count = 17.0
    messages = ['366675', '366750', '366751', '366753', '366754', '366797', '366844', '366845', '366848', '366850', '366853', '366857', '366859', '366862', '366864', '366873', '366895']
    nosy_count = 4.0
    nosy_names = ['tim.peters', 'pablogsal', 'a-feld', 'deekay']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue40312'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6', 'Python 3.7', 'Python 3.8', 'Python 3.9']
    

    Contributor guide

    Open the contributing guide

    First steps

    1. Read the whole issue, then the project's contributing guide.
    2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
    3. Fork the repository and make your change on a branch.
    4. Open a pull request that references the issue number.

    Research direction

    Start with the linked issue discussion and the uploaded 0001-Run-finalizers-before-invoking-weakref-callbacks.patch. Read the proposed change and surrounding CPython garbage-collection behavior before determining the required implementation and regression coverage. Done means weakref callbacks consistently run after finalizers during GC collection, with the relevant tests passing.

    Written by the indexing model from the issue text.

    Assessment

    Tech stack
    python
    Domain
    compilers
    Issue type
    Bug
    Difficulty
    5/5
    Estimated time
    Over a week
    Activity status
    Stale
    Clarity
    Mostly clear
    Newbie friendliness
    20/100

    Get new issues in your inbox

    A short digest of beginner-friendly GitHub issues.