File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -682,6 +682,9 @@ do { \
682682 ADD_INT_CONST_TO_TYPE (mod_state -> ZstdCompressor_type ,
683683 "FLUSH_FRAME" , ZSTD_e_end );
684684
685+ /* Make ZstdCompressor immutable */
686+ PyType_Freeze (mod_state -> ZstdCompressor_type );
687+
685688#undef ADD_TYPE
686689#undef ADD_INT_MACRO
687690#undef ADD_ZSTD_COMPRESSOR_INT_CONST
Original file line number Diff line number Diff line change @@ -886,6 +886,7 @@ static PyType_Slot ZstdDecompressor_slots[] = {
886886PyType_Spec zstd_decompressor_type_spec = {
887887 .name = "_zstd.ZstdDecompressor" ,
888888 .basicsize = sizeof (ZstdDecompressor ),
889- .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC ,
889+ .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE
890+ | Py_TPFLAGS_HAVE_GC ,
890891 .slots = ZstdDecompressor_slots ,
891892};
Original file line number Diff line number Diff line change @@ -281,6 +281,7 @@ static PyType_Slot zstddict_slots[] = {
281281PyType_Spec zstd_dict_type_spec = {
282282 .name = "_zstd.ZstdDict" ,
283283 .basicsize = sizeof (ZstdDict ),
284- .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC ,
284+ .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE
285+ | Py_TPFLAGS_HAVE_GC ,
285286 .slots = zstddict_slots ,
286287};
You can’t perform that action at this time.
0 commit comments