Skip to content

Commit a02c427

Browse files
committed
Add comment
1 parent 563706a commit a02c427

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Modules/_zstd/_zstdmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ do { \
679679
ADD_INT_CONST_TO_TYPE(mod_state->ZstdCompressor_type,
680680
"FLUSH_FRAME", ZSTD_e_end);
681681

682-
/* Make ZstdCompressor immutable */
682+
/* Make ZstdCompressor immutable (set Py_TPFLAGS_IMMUTABLETYPE) */
683683
PyType_Freeze(mod_state->ZstdCompressor_type);
684684

685685
#undef ADD_TYPE

Modules/_zstd/compressor.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,9 @@ static PyType_Slot zstdcompressor_slots[] = {
729729
PyType_Spec zstd_compressor_type_spec = {
730730
.name = "compression.zstd.ZstdCompressor",
731731
.basicsize = sizeof(ZstdCompressor),
732+
// Py_TPFLAGS_IMMUTABLETYPE is not used here as several
733+
// associated constants need to be added to the type.
734+
// PyType_Freeze is called later to set the flag.
732735
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
733736
.slots = zstdcompressor_slots,
734737
};

0 commit comments

Comments
 (0)