]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
class objects are read-only in restricted mode
authorGuido van Rossum <guido@python.org>
Fri, 4 Aug 1995 04:05:31 +0000 (04:05 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 4 Aug 1995 04:05:31 +0000 (04:05 +0000)
Objects/classobject.c

index d4a873f6fe227e22416478b7c8fd7312174cb1f1..0d0a10900e8f7c71b333ba86fb4de91132f58085 100644 (file)
@@ -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);