summaryrefslogtreecommitdiffstats
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2022-07-25 20:23:41 (GMT)
committerGitHub <noreply@github.com>2022-07-25 20:23:41 (GMT)
commit2d26449b06f310d72eb7df58a7133a16d47d30ed (patch)
tree95df743ca52323778ec9b1631d4ceb6788c9f334 /Objects/dictobject.c
parenta15ae19ffba33282d21440a8fb7c39af26b7d25e (diff)
downloadcpython-2d26449b06f310d72eb7df58a7133a16d47d30ed.zip
cpython-2d26449b06f310d72eb7df58a7133a16d47d30ed.tar.gz
cpython-2d26449b06f310d72eb7df58a7133a16d47d30ed.tar.bz2
gh-94673: Always Finalize Static Builtin Types (#95153)
Static builtin types are finalized by calling _PyStaticType_Dealloc(). Before this change, we were skipping finalizing such a type if it still had subtypes (i.e. its tp_subclasses hadn't been cleared yet). The problem is that types hold several heap objects, which leak if we skip the type's finalization. This change addresses that. For context, there's an old comment (from e9e3eab0b86) that says the following: // If a type still has subtypes, it cannot be deallocated. // A subtype can inherit attributes and methods of its parent type, // and a type must no longer be used once it's deallocated. However, it isn't clear that is actually still true. Clearing tp_dict should mean it isn't a problem. Furthermore, the only subtypes that might still be around come from extension modules that didn't clean them up when unloaded (i.e. extensions that do not implement multi-phase initialization, AKA PEP 489). Those objects are already leaking, so this change doesn't change anything in that regard. Instead, this change means more objects gets cleaned up that before.
Diffstat (limited to 'Objects/dictobject.c')
0 files changed, 0 insertions, 0 deletions