Skip to content

_PyObject_XDecRefDelayed() should handle immortal objects #159431

Open

Description

@nascheme

Bug report

The callers of _PyObject_XDecRefDelayed() currently check if an object is immortal. However, that's insufficient, since the object could become immortal after it's queued and before the queue is processed. That triggers an assertion failure in debug builds. In release builds the object silently becomes mortal. The check has to happen when the queue is processed.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added a commit that references this issue on Oct 14, 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