Skip to content

Refactor codegen_deferred_annotations_body to ensure mangled is decref'd #148059

Description

@A0su

Bug report

Bug description:

Follow-up item from this PR: #146443 (review)

During error cases we may fail to decref mangled while using these ADDOP* and VISIT macros. As a result, we can extract the for loop's body into a subfunction that we check the return of and decref mangled if needed.

        // NOTE: ref of mangled can be leaked on ADDOP* and VISIT macros due to early returns
        // fixing would require an overhaul of these macros

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    on Apr 3, 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

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions