summaryrefslogtreecommitdiffstats
path: root/Objects/funcobject.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/funcobject.c
parentc11348287187606efd7a0dce76269440ca170f8e (diff)
downloadcpython-10393b170863799bbfa785410828e468c84d4937.zip
cpython-10393b170863799bbfa785410828e468c84d4937.tar.gz
cpython-10393b170863799bbfa785410828e468c84d4937.tar.bz2
add restrictions in restricted mode
Diffstat (limited to 'Objects/funcobject.c')
-rw-r--r--Objects/funcobject.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 304fb37..e2ba2a9 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -127,6 +127,7 @@ static struct memberlist func_memberlist[] = {
{"func_code", T_OBJECT, OFF(func_code), READONLY},
{"func_globals",T_OBJECT, OFF(func_globals), READONLY},
{"func_name", T_OBJECT, OFF(func_name), READONLY},
+ {"__name__", T_OBJECT, OFF(func_name), READONLY},
{"func_argcount",T_INT, OFF(func_argcount), READONLY},
{"func_argdefs",T_OBJECT, OFF(func_argdefs), READONLY},
{"func_doc", T_OBJECT, OFF(func_doc)},
@@ -139,6 +140,11 @@ func_getattr(op, name)
funcobject *op;
char *name;
{
+ if (name[0] != '_' && getrestricted()) {
+ err_setstr(RuntimeError,
+ "function attributes not accessible in restricted mode");
+ return NULL;
+ }
return getmember((char *)op, func_memberlist, name);
}