]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-44184: Fix subtype_dealloc() for freed type (GH-26274) (GH-26290)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 21 May 2021 22:50:11 +0000 (15:50 -0700)
committerGitHub <noreply@github.com>
Fri, 21 May 2021 22:50:11 +0000 (00:50 +0200)
commit50b0d148a68072292832eb69bdf1815b8059355f
treefa1d73efadcf398b0c6dd33b364e13841d66b8a0
parent856958d0e750a62bd5e6a231c3ed67aa0db32e11
bpo-44184: Fix subtype_dealloc() for freed type (GH-26274) (GH-26290)

Fix a crash at Python exit when a deallocator function removes the
last strong reference to a heap type.

Don't read type memory after calling basedealloc() since
basedealloc() can deallocate the type and free its memory.

_PyMem_IsPtrFreed() argument is now constant.
(cherry picked from commit 615069eb08494d089bf24e43547fbc482ed699b8)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
Include/internal/pycore_pymem.h
Lib/test/test_gc.py
Misc/NEWS.d/next/Core and Builtins/2021-05-21-01-42-45.bpo-44184.9qOptC.rst [new file with mode: 0644]
Objects/typeobject.c