mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
add restrictions in restricted mode
This commit is contained in:
parent
c113482871
commit
10393b1708
3 changed files with 45 additions and 25 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue