Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: reset list allocated to 0
  • Loading branch information
KowalskiThomas committed Mar 9, 2026
commit 5a4d8b8a198e18d01f2e0d5b75568cfd17acfa6e
1 change: 1 addition & 0 deletions Objects/listobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3260,6 +3260,7 @@ _PyList_AsTupleAndClear(PyListObject *self)
Py_ssize_t size = Py_SIZE(self);
self->ob_item = NULL;
Py_SET_SIZE(self, 0);
self->allocated = 0;
Copy link
Copy Markdown
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
Copy Markdown
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.

ret = _PyTuple_FromArraySteal(items, size);
free_list_items(items, false);
Py_END_CRITICAL_SECTION();
Expand Down
Loading