PyUnstable_Eval_RequestCodeExtraIndex freefunc may be called with a null pointer
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- PR merge metrics
- PR metrics pending
Description
Bug report
Bug description:
The PyUnstable_Code_SetExtra path checks for the previous value being null but code_dealloc does not.
This can lead to freefunc being called with null either through the extra value being explicitly set to null or through a value being set on an extra value with a later index, without a value being set on an earlier index.
This doesn't match the documentation, which says that freefunc is not called for null values.
CPython versions tested on:
3.11, CPython main branch
Operating systems tested on:
Linux
Linked PRs
- gh-122492
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 in Objects/codeobject.c at the PyUnstable_Code_SetExtra check and the code_dealloc path linked in the report. Compare both paths with the documented null-value behavior, then inspect linked PR gh-122492 for the work already underway and its validation approach.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 20/100