@@ -5063,15 +5063,13 @@ static PyType_Slot pickle_pickler_type_slots[] = {
5063
5063
{Py_tp_clear , Pickler_clear },
5064
5064
{Py_tp_doc , (char * )_pickle_Pickler___init____doc__ },
5065
5065
{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 },
5066
5070
{0 , 0 }
5067
5071
};
5068
5072
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
-
5075
5073
static PyType_Spec pickle_pickler_type_spec = {
5076
5074
.name = "_pickle.Pickler" ,
5077
5075
.basicsize = sizeof (PicklerObject ),
@@ -7555,6 +7553,10 @@ static PyType_Slot pickle_unpickler_type_slots[] = {
7555
7553
{Py_tp_clear , Unpickler_clear },
7556
7554
{Py_tp_methods , Unpickler_methods },
7557
7555
{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 },
7558
7560
{0 ,0 }
7559
7561
};
7560
7562
0 commit comments