Mercurial > cpython-lru_cache-weakref
diff Objects/accessobject.c @ 1290:7971fecbf28e legacy-trunk
* Lots of small changes related to access.
* Added "access *: ...", made access work for class methods.
* Introduced subclass check: make sure that when calling
ClassName.methodname(instance, ...), the instance is an instance of
ClassName or of a subclass thereof (this might break some old code!)
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 21 May 1993 19:56:10 +0000 |
| parents | 4d292c7857d4 |
| children | ac3c80abbf43 |
line wrap: on
line diff
--- a/Objects/accessobject.c Thu May 20 14:24:46 1993 +0000 +++ b/Objects/accessobject.c Fri May 21 19:56:10 1993 +0000 @@ -99,6 +99,15 @@ ap->ac_class = class; } +int +hasaccessvalue(op) + object *op; +{ + if (!is_accessobject(op)) + return 0; + return ((accessobject *)op)->ac_value != NULL; +} + object * getaccessvalue(op, class) object *op; @@ -268,7 +277,9 @@ char buf[300]; classobject *class = (classobject *)ap->ac_class; typeobject *type = ap->ac_type; - sprintf(buf, "<access object, class %.100s, type %.100s, mode 0%o>", + sprintf(buf, + "<access object, value 0x%lx, class %.100s, type %.100s, mode %04o>", + (long)(ap->ac_value), class ? getstringvalue(class->cl_name) : "-", type ? type->tp_name : "-", ap->ac_mode);
