summaryrefslogtreecommitdiffstats
path: root/Objects/accessobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-05-21 19:56:10 (GMT)
committerGuido van Rossum <guido@python.org>1993-05-21 19:56:10 (GMT)
commitb3f7258f14cb2f3e52236a4087ed82541a173e7b (patch)
tree4bb2d9aa0d0dbdd7fca7fdb22eaa80c98b27cbb7 /Objects/accessobject.c
parent81daa32c15cfa9f05eda037916cdbfd5b4323431 (diff)
downloadcpython-b3f7258f14cb2f3e52236a4087ed82541a173e7b.zip
cpython-b3f7258f14cb2f3e52236a4087ed82541a173e7b.tar.gz
cpython-b3f7258f14cb2f3e52236a4087ed82541a173e7b.tar.bz2
* 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!)
Diffstat (limited to 'Objects/accessobject.c')
-rw-r--r--Objects/accessobject.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/Objects/accessobject.c b/Objects/accessobject.c
index 41790cd..6fd9bd5 100644
--- a/Objects/accessobject.c
+++ b/Objects/accessobject.c
@@ -99,6 +99,15 @@ setaccessowner(op, class)
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 @@ access_repr(ap)
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);