diff options
Diffstat (limited to 'Objects/classobject.c')
-rw-r--r-- | Objects/classobject.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c index c0eb8f1..6008999 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -355,13 +355,15 @@ instance_getattr(inst, name) { register object *v; classobject *class; - if (strcmp(name, "__dict__") == 0) { - INCREF(inst->in_dict); - return inst->in_dict; - } - if (strcmp(name, "__class__") == 0) { - INCREF(inst->in_class); - return (object *)inst->in_class; + if (name[0] == '_' && name[1] == '_') { + if (strcmp(name, "__dict__") == 0) { + INCREF(inst->in_dict); + return inst->in_dict; + } + if (strcmp(name, "__class__") == 0) { + INCREF(inst->in_class); + return (object *)inst->in_class; + } } class = NULL; v = dictlookup(inst->in_dict, name); |