Mercurial > cpython-lru_cache-weakref
diff Objects/methodobject.c @ 2105:ea7b2bf0b521 legacy-trunk
add restrictions in restricted mode
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 10 Jan 1995 10:39:49 +0000 |
| parents | f2d267edbfd6 |
| children | d091b246a3a7 |
line wrap: on
line diff
--- a/Objects/methodobject.c Tue Jan 10 10:39:16 1995 +0000 +++ b/Objects/methodobject.c Tue Jan 10 10:39:49 1995 +0000 @@ -107,7 +107,13 @@ 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);
