Kaydet (Commit) 85f50769 authored tarafından Guido van Rossum's avatar Guido van Rossum

Added __dict__ attributes all over the place.

üst e0e5edcb
...@@ -1039,12 +1039,18 @@ text_getattr(tp, name) ...@@ -1039,12 +1039,18 @@ text_getattr(tp, name)
textobject *tp; textobject *tp;
char *name; char *name;
{ {
if (tp->t_attr != NULL) { object *v = NULL;
object *v = dictlookup(tp->t_attr, name); if (strcmp(name, "__dict__") == 0) {
if (v != NULL) { v = tp->t_attr;
INCREF(v); if (v == NULL)
return v; v = None;
} }
else if (tp->t_attr != NULL) {
v = dictlookup(tp->t_attr, name);
}
if (v != NULL) {
INCREF(v);
return v;
} }
return findmethod(text_methods, (object *)tp, name); return findmethod(text_methods, (object *)tp, name);
} }
...@@ -1217,12 +1223,18 @@ menu_getattr(mp, name) ...@@ -1217,12 +1223,18 @@ menu_getattr(mp, name)
menuobject *mp; menuobject *mp;
char *name; char *name;
{ {
if (mp->m_attr != NULL) { object *v = NULL;
object *v = dictlookup(mp->m_attr, name); if (strcmp(name, "__dict__") == 0) {
if (v != NULL) { v = mp->m_attr;
INCREF(v); if (v == NULL)
return v; v = None;
} }
else if (mp->m_attr != NULL) {
v = dictlookup(mp->m_attr, name);
}
if (v != NULL) {
INCREF(v);
return v;
} }
return findmethod(menu_methods, (object *)mp, name); return findmethod(menu_methods, (object *)mp, name);
} }
...@@ -1575,12 +1587,18 @@ window_getattr(wp, name) ...@@ -1575,12 +1587,18 @@ window_getattr(wp, name)
windowobject *wp; windowobject *wp;
char *name; char *name;
{ {
if (wp->w_attr != NULL) { object *v = NULL;
object *v = dictlookup(wp->w_attr, name); if (strcmp(name, "__dict__") == 0) {
if (v != NULL) { v = wp->w_attr;
INCREF(v); if (v == NULL)
return v; v = None;
} }
else if (wp->w_attr != NULL) {
v = dictlookup(wp->w_attr, name);
}
if (v != NULL) {
INCREF(v);
return v;
} }
return findmethod(window_methods, (object *)wp, name); return findmethod(window_methods, (object *)wp, name);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment