Skip to content

gh-145681: reset list allocated to 0#145680

Draft
KowalskiThomas wants to merge 1 commit intopython:mainfrom
KowalskiThomas:kowalski/fix-reset-list-allocated-to-0
Draft

gh-145681: reset list allocated to 0#145680
KowalskiThomas wants to merge 1 commit intopython:mainfrom
KowalskiThomas:kowalski/fix-reset-list-allocated-to-0

Conversation

@KowalskiThomas
Copy link
Contributor

@KowalskiThomas KowalskiThomas commented Mar 9, 2026

Description

This is a fix for gh-145681.

Note I wanted to open this PR in my fork for the time being (until issue has been reviewed/triaged), but I accidentally opened it in the public CPython directly... Sorry about that.

@KowalskiThomas KowalskiThomas changed the title fix: reset list allocated to 0 gh-145681: reset list allocated to 0 Mar 9, 2026
@KowalskiThomas
Copy link
Contributor Author

I meant to open this PR in my fork until my issue has been reviewed/triaged and bug has been confirmed or rejected but I forgot to select the target repo for the PR... sorry about this.

Py_ssize_t size = Py_SIZE(self);
self->ob_item = NULL;
Py_SET_SIZE(self, 0);
self->allocated = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list_clear_impl has extra code if Py_GIL_DISABLED - should we include it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment, there is a discussion on the issue right now but I'll keep that in mind when time comes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants