Refactor `codegen_deferred_annotations_body` to ensure `mangled` is decref'd
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Bug report
Bug description:
Follow-up item from this PR: https://github.com/python/cpython/pull/146443#pullrequestreview-4033013919
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
- gh-148060
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating codegen_deferred_annotations_body and inspect the for-loop using the ADDOP* and VISIT macros, then review linked PR 146443 and PR 148060 for context. Done means the loop's error path no longer leaves mangled unreleased while preserving the existing code-generation behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100