From ac21f6a5797286e97136723a094f5b86070cde55 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 4 Aug 1995 04:05:31 +0000 Subject: [PATCH] class objects are read-only in restricted mode --- Objects/classobject.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Objects/classobject.c b/Objects/classobject.c index d4a873f6fe2..0d0a10900e8 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);