diff options
author | Guido van Rossum <guido@python.org> | 1996-08-09 20:52:03 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-08-09 20:52:03 +0000 |
commit | e9f08e795eecfe668df8cc3796f5dc1bbf4081b2 (patch) | |
tree | 424a9178aa533881cfe3e06e0f916c4866f3c0a0 /Objects/object.c | |
parent | 5b58c57a412abb678b60f6ad0e45baa6ba04a05a (diff) | |
download | cpython-e9f08e795eecfe668df8cc3796f5dc1bbf4081b2.tar.gz |
Support for tp_getattro, tp_setattro (Sjoerd)
Diffstat (limited to 'Objects/object.c')
-rw-r--r-- | Objects/object.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c index be40c40ed3..9d8a16bc89 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -326,6 +326,16 @@ getattr(v, name) object *v; char *name; { + if (v->ob_type->tp_getattro != NULL) { + object *w, *res; + w = newstringobject(name); + if (w == NULL) + return NULL; + res = (*v->ob_type->tp_getattro)(v, w); + XDECREF(w); + return res; + } + if (v->ob_type->tp_getattr == NULL) { err_setstr(AttributeError, "attribute-less object"); return NULL; @@ -355,6 +365,17 @@ setattr(v, name, w) char *name; object *w; { + if (v->ob_type->tp_setattro != NULL) { + object *s; + int res; + s = newstringobject(name); + if (s == NULL) + return NULL; + res = (*v->ob_type->tp_setattro)(v, s, w); + XDECREF(s); + return res; + } + if (v->ob_type->tp_setattr == NULL) { if (v->ob_type->tp_getattr == NULL) err_setstr(TypeError, |