summaryrefslogtreecommitdiffstats
path: root/Objects/classobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/classobject.c')
-rw-r--r--Objects/classobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index d4a873f6..0d0a109 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -174,6 +174,11 @@ class_setattr(op, name, v)
return -1;
}
}
+ if (getrestricted()) {
+ err_setstr(RuntimeError,
+ "classes are read-only in restricted mode");
+ return -1;
+ }
ac = dictlookup(op->cl_dict, name);
if (ac != NULL && is_accessobject(ac))
return setaccessvalue(ac, getowner(), v);