add restrictions in restricted mode

This commit is contained in:
Guido van Rossum 1995-01-10 10:39:49 +00:00
parent c113482871
commit 10393b1708
3 changed files with 45 additions and 25 deletions

View file

@ -107,7 +107,13 @@ meth_getattr(m, name)
return None;
}
if (strcmp(name, "__self__") == 0) {
object *self = m->m_self;
object *self;
if (getrestricted()) {
err_setstr(RuntimeError,
"method.__self__ not accessible in restricted mode");
return NULL;
}
self = m->m_self;
if (self == NULL)
self = None;
INCREF(self);