diff options
Diffstat (limited to 'Objects/methodobject.c')
-rw-r--r-- | Objects/methodobject.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Objects/methodobject.c b/Objects/methodobject.c index c33cea5..61420aa 100644 --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -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); |