summaryrefslogtreecommitdiffstats
path: root/Include/classobject.h
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 /Include/classobject.h
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 'Include/classobject.h')
-rw-r--r--Include/classobject.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/Include/classobject.h b/Include/classobject.h
index ec07b59..ccab6a3 100644
--- a/Include/classobject.h
+++ b/Include/classobject.h
@@ -24,11 +24,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Class object interface */
-/*
-Classes are really hacked in at the last moment.
-It should be possible to use other object types as base classes,
-but currently it isn't. We'll see if we can fix that later, sigh...
-*/
+/* Revealing some structures (not for general use) */
typedef struct {
OB_HEAD
@@ -37,6 +33,12 @@ typedef struct {
object *cl_name; /* A string */
} classobject;
+typedef struct {
+ OB_HEAD
+ classobject *in_class; /* The class object */
+ object *in_dict; /* A dictionary */
+} instanceobject;
+
extern typeobject Classtype, Instancetype, Instancemethodtype;
#define is_classobject(op) ((op)->ob_type == &Classtype)