[Python-checkins] CVS: python/dist/src/Include descrobject.h,NONE,1.1.2.1 Python.h,2.32,2.32.2.1 object.h,2.79,2.79.2.1

Guido van Rossum gvanrossum@users.sourceforge.net
Mon, 23 Apr 2001 17:49:10 -0700


Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv23212/Include

Modified Files:
      Tag: descr-branch
	Python.h object.h 
Added Files:
      Tag: descr-branch
	descrobject.h 
Log Message:
Interim commit to descriptors prototype; see PEP 252.

--- NEW FILE: descrobject.h ---
/* XXX getter, setter, and struct getsetlist need 'Py'-prefixed names */

typedef PyObject *(*getter)(PyObject *, void *);
typedef int (*setter)(PyObject *, PyObject *, void *);

struct getsetlist {
	char *name;
	getter get;
	setter set;
	void *closure;
};

extern PyTypeObject PyDescr_Type;

#define PyDescr_Check(d) ((d)->ob_type == &PyDescr_Type)

typedef struct PyDescrObject PyDescrObject;

extern DL_IMPORT(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
extern DL_IMPORT(PyObject *) PyDescr_NewMember(PyTypeObject *,
					       struct memberlist *);
extern DL_IMPORT(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
					       struct getsetlist *);

extern DL_IMPORT(PyObject *) PyDescr_Get(PyObject *, PyObject *);
extern DL_IMPORT(int) PyDescr_Set(PyObject *, PyObject *, PyObject *);

extern DL_IMPORT(int) PyType_InitDict(PyTypeObject *);

Index: Python.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v
retrieving revision 2.32
retrieving revision 2.32.2.1
diff -C2 -r2.32 -r2.32.2.1
*** Python.h	2001/04/20 19:13:01	2.32
--- Python.h	2001/04/24 00:49:08	2.32.2.1
***************
*** 84,87 ****
--- 84,88 ----
  #include "cellobject.h"
  #include "iterobject.h"
+ #include "descrobject.h"
  
  #include "codecs.h"

Index: object.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/object.h,v
retrieving revision 2.79
retrieving revision 2.79.2.1
diff -C2 -r2.79 -r2.79.2.1
*** object.h	2001/04/23 14:08:49	2.79
--- object.h	2001/04/24 00:49:08	2.79.2.1
***************
*** 256,259 ****
--- 256,266 ----
  	iternextfunc tp_iternext;
  
+ 	/* Attribute descriptor stuff */
+ 	struct PyMethodDef *tp_methods;
+ 	struct memberlist *tp_members;
+ 	struct getsetlist *tp_getset;
+ 	struct _typeobject *tp_base;
+ 	PyObject *tp_dict;
+ 
  #ifdef COUNT_ALLOCS
  	/* these must be last and never explicitly initialized */
***************
*** 358,361 ****
--- 365,371 ----
  #define Py_TPFLAGS_HAVE_ITER (1L<<7)
  
+ /* Experimental stuff for healing the type/class split */
+ #define Py_TPFLAGS_HAVE_CLASS (1L<<8)
+ 
  #define Py_TPFLAGS_DEFAULT  ( \
                               Py_TPFLAGS_HAVE_GETCHARBUFFER | \
***************
*** 365,368 ****
--- 375,379 ----
                               Py_TPFLAGS_HAVE_WEAKREFS | \
                               Py_TPFLAGS_HAVE_ITER | \
+                              Py_TPFLAGS_HAVE_CLASS | \
                              0)