]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-145681: do not deallocate list buffer in `_PyList_AsTupleAndClear` (GH-145680)
authorThomas Kowalski <thom.kowa@gmail.com>
Thu, 12 Mar 2026 13:27:07 +0000 (14:27 +0100)
committerGitHub <noreply@github.com>
Thu, 12 Mar 2026 13:27:07 +0000 (14:27 +0100)
commit7836ecc5daf541061de2072070f7371d41b009ee
treebce6a434ded85cf0a85a219e27ccdbf306892d0b
parent453562a467a1f78a851ee12e7a556d1fe34f5a44
gh-145681: do not deallocate list buffer in `_PyList_AsTupleAndClear` (GH-145680)

Setting the size to 0 turns the list contents into overallocated memory that the deallocator will free.
Ownership is transferred to the new tuple so no refcount adjustment is needed.
Objects/listobject.c