summaryrefslogtreecommitdiffstats
path: root/Objects/classobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-08-04 04:05:31 (GMT)
committerGuido van Rossum <guido@python.org>1995-08-04 04:05:31 (GMT)
commitac21f6a5797286e97136723a094f5b86070cde55 (patch)
treeafaf7295aea68cae4f47bbc77db2c22bf41a5146 /Objects/classobject.c
parent055968c06844498fc4e8e6bdefe737828b8525ca (diff)
downloadcpython-ac21f6a5797286e97136723a094f5b86070cde55.zip
cpython-ac21f6a5797286e97136723a094f5b86070cde55.tar.gz
cpython-ac21f6a5797286e97136723a094f5b86070cde55.tar.bz2
class objects are read-only in restricted 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);