diff Include/classobject.h @ 1774:9d362e5e4e78 legacy-trunk

* Objects/classobject.c, Include/classobject.h: added __getattr__ and __setattr__ support to override getattr(x, name) and setattr(x, name, value) for class instances. This uses a special hack whereby the class is supposed to be static: the __getattr__ and __setattr__ methods are looked up only once and saved in the instance structure for speed
author Guido van Rossum <guido@python.org>
date Fri, 12 Aug 1994 12:49:46 +0000
parents 1940892d2fe3
children 9b530bb54642
line wrap: on
line diff
--- a/Include/classobject.h	Fri Aug 12 12:46:05 1994 +0000
+++ b/Include/classobject.h	Fri Aug 12 12:49:46 1994 +0000
@@ -30,6 +30,12 @@
 
 /* Class object interface */
 
+#ifdef WITH_THREAD
+#include "thread.h"
+#else
+#define get_thread_ident() 1L
+#endif
+
 /* Revealing some structures (not for general use) */
 
 typedef struct {
@@ -43,6 +49,12 @@
 	OB_HEAD
 	classobject	*in_class;	/* The class object */
 	object		*in_dict;	/* A dictionary */
+	object		*in_getattr;	/* A method or NULL */
+	object		*in_setattr;	/* A method or NULL */
+	long		in_ident;	/* A thread ident or 0 */
+#ifdef WITH_THREAD
+	type_lock	*in_lock;	/* A lock or NULL */
+#endif
 } instanceobject;
 
 extern typeobject Classtype, Instancetype, Instancemethodtype;