Skip to content

gh-145681: reset list allocated to 0#145680

Open
KowalskiThomas wants to merge 3 commits intopython:mainfrom
KowalskiThomas:kowalski/fix-reset-list-allocated-to-0
Open

gh-145681: reset list allocated to 0#145680
KowalskiThomas wants to merge 3 commits 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.

Copy link
Member

@encukou encukou left a comment

Choose a reason for hiding this comment

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

Looks good!
Do you want to take this out of draft?

@KowalskiThomas KowalskiThomas marked this pull request as ready for review March 11, 2026 14:17
@KowalskiThomas
Copy link
Contributor Author

Do you want to take this out of draft?

Oops, yes!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants