]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-44184: Fix subtype_dealloc() for freed type (GH-26274)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 15 Jul 2021 23:36:51 +0000 (16:36 -0700)
committerGitHub <noreply@github.com>
Thu, 15 Jul 2021 23:36:51 +0000 (16:36 -0700)
commit298ee657ab8170adf75a186c0414b7ca3baf1991
tree17307435e9ee9871f12df489ea194d102f9dc13f
parent0b4704973dbef712d05bdd62349bb4244f545430
bpo-44184: Fix subtype_dealloc() for freed type (GH-26274)

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>
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