We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b48a3db commit af4f903Copy full SHA for af4f903
1 file changed
Objects/typeobject.c
@@ -1125,15 +1125,16 @@ static PyMemberDef type_members[] = {
1125
static int
1126
check_set_special_type_attr(PyTypeObject *type, PyObject *value, const char *name)
1127
{
1128
- if (_PyType_HasFeature(type, Py_TPFLAGS_IMMUTABLETYPE)) {
+
1129
+ if (!value) {
1130
PyErr_Format(PyExc_TypeError,
- "cannot set '%s' attribute of immutable type '%s'",
1131
+ "cannot delete '%s' attribute of type '%s'",
1132
name, type->tp_name);
1133
return 0;
1134
}
- if (!value) {
1135
+ if (_PyType_HasFeature(type, Py_TPFLAGS_IMMUTABLETYPE)) {
1136
- "cannot delete '%s' attribute of immutable type '%s'",
1137
+ "cannot set '%s' attribute of immutable type '%s'",
1138
1139
1140
0 commit comments