summaryrefslogtreecommitdiffstats
path: root/Objects/methodobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-01-10 10:39:49 (GMT)
committerGuido van Rossum <guido@python.org>1995-01-10 10:39:49 (GMT)
commit10393b170863799bbfa785410828e468c84d4937 (patch)
tree326bdfaf43a8653f8d7e340d21c339cd71c6f24b /Objects/methodobject.c
parentc11348287187606efd7a0dce76269440ca170f8e (diff)
downloadcpython-10393b170863799bbfa785410828e468c84d4937.zip
cpython-10393b170863799bbfa785410828e468c84d4937.tar.gz
cpython-10393b170863799bbfa785410828e468c84d4937.tar.bz2
add restrictions in restricted mode
Diffstat (limited to 'Objects/methodobject.c')
-rw-r--r--Objects/methodobject.c8
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);