@@ -5063,15 +5063,13 @@ static PyType_Slot pickle_pickler_type_slots[] = {
50635063 {Py_tp_clear , Pickler_clear },
50645064 {Py_tp_doc , (char * )_pickle_Pickler___init____doc__ },
50655065 {Py_tp_traverse , Pickler_traverse },
5066+ {Py_tp_init , _pickle_Pickler___init__ },
5067+ {Py_tp_new , PyType_GenericNew },
5068+ {Py_tp_alloc , PyType_GenericAlloc },
5069+ {Py_tp_free , PyObject_GC_Del },
50665070 {0 , 0 }
50675071};
50685072
5069- //TODO - how to handle this??
5070- // Calling PyType_GetModuleState() on a subclass is not safe.
5071- // bz2_compressor_type_spec does not have Py_TPFLAGS_BASETYPE flag
5072- // which prevents to create a subclass.
5073- // So calling PyType_GetModuleState() in this file is always safe.
5074-
50755073static PyType_Spec pickle_pickler_type_spec = {
50765074 .name = "_pickle.Pickler" ,
50775075 .basicsize = sizeof (PicklerObject ),
@@ -7555,6 +7553,10 @@ static PyType_Slot pickle_unpickler_type_slots[] = {
75557553 {Py_tp_clear , Unpickler_clear },
75567554 {Py_tp_methods , Unpickler_methods },
75577555 {Py_tp_getset , Unpickler_getsets },
7556+ {Py_tp_init , _pickle_Unpickler___init__ },
7557+ {Py_tp_alloc , PyType_GenericAlloc },
7558+ {Py_tp_new , PyType_GenericNew },
7559+ {Py_tp_free , PyObject_GC_Del },
75587560 {0 ,0 }
75597561};
75607562
0 commit comments