diff options
author | Guido van Rossum <guido@python.org> | 1991-10-20 20:22:50 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1991-10-20 20:22:50 (GMT) |
commit | 85f50769628af33809c321f829948af3f0db77cc (patch) | |
tree | 8391a2ed50a8ae9fbd3eec2d0abe3c8c4171e796 /Modules/stdwinmodule.c | |
parent | e0e5edcb6ee413f723663e46ee7032a4d6dd1ac1 (diff) | |
download | cpython-85f50769628af33809c321f829948af3f0db77cc.zip cpython-85f50769628af33809c321f829948af3f0db77cc.tar.gz cpython-85f50769628af33809c321f829948af3f0db77cc.tar.bz2 |
Added __dict__ attributes all over the place.
Diffstat (limited to 'Modules/stdwinmodule.c')
-rw-r--r-- | Modules/stdwinmodule.c | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/Modules/stdwinmodule.c b/Modules/stdwinmodule.c index 8a652e3..f8c312e 100644 --- a/Modules/stdwinmodule.c +++ b/Modules/stdwinmodule.c @@ -1039,12 +1039,18 @@ text_getattr(tp, name) textobject *tp; char *name; { - if (tp->t_attr != NULL) { - object *v = dictlookup(tp->t_attr, name); - if (v != NULL) { - INCREF(v); - return v; - } + object *v = NULL; + if (strcmp(name, "__dict__") == 0) { + v = tp->t_attr; + if (v == NULL) + 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); } @@ -1217,12 +1223,18 @@ menu_getattr(mp, name) menuobject *mp; char *name; { - if (mp->m_attr != NULL) { - object *v = dictlookup(mp->m_attr, name); - if (v != NULL) { - INCREF(v); - return v; - } + object *v = NULL; + if (strcmp(name, "__dict__") == 0) { + v = mp->m_attr; + if (v == NULL) + 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); } @@ -1575,12 +1587,18 @@ window_getattr(wp, name) windowobject *wp; char *name; { - if (wp->w_attr != NULL) { - object *v = dictlookup(wp->w_attr, name); - if (v != NULL) { - INCREF(v); - return v; - } + object *v = NULL; + if (strcmp(name, "__dict__") == 0) { + v = wp->w_attr; + if (v == NULL) + 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); } |