mirror of
https://github.com/python/cpython.git
synced 2025-10-06 23:21:06 +00:00
bpo-46417: Clear Unicode static types at exit (GH-30806)
Add _PyUnicode_FiniTypes() function, called by finalize_interp_types(). It clears these static types: * EncodingMapType * PyFieldNameIter_Type * PyFormatterIter_Type _PyStaticType_Dealloc() now does nothing if tp_subclasses is not NULL.
This commit is contained in:
parent
621a45ccac
commit
1626bf4ac7
6 changed files with 25 additions and 22 deletions
|
@ -4079,10 +4079,12 @@ type_dealloc_common(PyTypeObject *type)
|
|||
void
|
||||
_PyStaticType_Dealloc(PyTypeObject *type)
|
||||
{
|
||||
// _PyStaticType_Dealloc() must not be called if a type has subtypes.
|
||||
// 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.
|
||||
assert(type->tp_subclasses == NULL);
|
||||
if (type->tp_subclasses != NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
type_dealloc_common(type);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue