summaryrefslogtreecommitdiffstats
path: root/Modules/_struct.c
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-06-26 10:12:01 (GMT)
committerGitHub <noreply@github.com>2022-06-26 10:12:01 (GMT)
commit17ed560fcd0a1442485f9bd48884bbe412f35abc (patch)
treea6d11a5d9ea388f6552e3898aa38b1ea9f98ce8c /Modules/_struct.c
parent27934bef2dd9878e04707f090ff5c1ede3278aee (diff)
downloadcpython-17ed560fcd0a1442485f9bd48884bbe412f35abc.zip
cpython-17ed560fcd0a1442485f9bd48884bbe412f35abc.tar.gz
cpython-17ed560fcd0a1442485f9bd48884bbe412f35abc.tar.bz2
GH-94254: Make _struct module types immutable (#94269)
Diffstat (limited to 'Modules/_struct.c')
-rw-r--r--Modules/_struct.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 20307ad..9d66568 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -1741,7 +1741,8 @@ static PyType_Spec unpackiter_type_spec = {
"_struct.unpack_iterator",
sizeof(unpackiterobject),
0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+ (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+ Py_TPFLAGS_IMMUTABLETYPE),
unpackiter_type_slots
};
@@ -2110,7 +2111,8 @@ static PyType_Spec PyStructType_spec = {
"_struct.Struct",
sizeof(PyStructObject),
0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
+ (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+ Py_TPFLAGS_BASETYPE | Py_TPFLAGS_IMMUTABLETYPE),
PyStructType_slots
};