summaryrefslogtreecommitdiff
path: root/Modules/_struct.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-06-26 03:45:00 -0700
committerGitHub <noreply@github.com>2022-06-26 03:45:00 -0700
commitc481cd6256f0e4493fa28f26c5902101803abadb (patch)
tree69bfd6c832289df28de763e7c0830f89708107b7 /Modules/_struct.c
parent4b1144ced142be2765f5d14c9632cee2b75748f2 (diff)
downloadcpython-git-c481cd6256f0e4493fa28f26c5902101803abadb.tar.gz
GH-94254: Make _struct module types immutable (GH-94269)
(cherry picked from commit 17ed560fcd0a1442485f9bd48884bbe412f35abc) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
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 79806ea0d9..cf0a6fdead 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -1740,7 +1740,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
};
@@ -2111,7 +2112,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
};