[Python-checkins] CVS: python/dist/src/Include descrobject.h,1.1,2.1 Python.h,2.37,2.38 abstract.h,2.34,2.35 ceval.h,2.43,2.44 classobject.h,2.37,2.38 dictobject.h,2.20,2.21 eval.h,2.14,2.15 funcobject.h,2.23,2.24 listobject.h,2.21,2.22 modsupport.h,2.36,2.37 object.h,2.79,2.80 objimpl.h,2.34,2.35 patchlevel.h,2.50,2.51 pythonrun.h,2.43,2.44

Tim Peters tim_one@users.sourceforge.net
Wed, 01 Aug 2001 21:15:02 -0700


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

Modified Files:
	Python.h abstract.h ceval.h classobject.h dictobject.h eval.h 
	funcobject.h listobject.h modsupport.h object.h objimpl.h 
	patchlevel.h pythonrun.h 
Added Files:
	descrobject.h 
Log Message:
Merge of descr-branch back into trunk.



Index: Python.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v
retrieving revision 2.37
retrieving revision 2.38
diff -C2 -d -r2.37 -r2.38
*** Python.h	2001/07/26 21:34:59	2.37
--- Python.h	2001/08/02 04:15:00	2.38
***************
*** 90,93 ****
--- 90,94 ----
  #include "cellobject.h"
  #include "iterobject.h"
+ #include "descrobject.h"
  
  #include "codecs.h"

Index: abstract.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v
retrieving revision 2.34
retrieving revision 2.35
diff -C2 -d -r2.34 -r2.35
*** abstract.h	2001/05/05 21:05:01	2.34
--- abstract.h	2001/08/02 04:15:00	2.35
***************
*** 295,298 ****
--- 295,309 ----
  
  
+ 
+      DL_IMPORT(PyObject *) PyObject_Call(PyObject *callable_object,
+ 					 PyObject *args, PyObject *kw);
+ 
+        /*
+ 
+ 	 Call a callable Python object, callable_object, with
+ 	 arguments and keywords arguments.  The 'args' argument can not be
+ 	 NULL, but the 'kw' argument can be NULL.
+ 
+        */
       
       DL_IMPORT(PyObject *) PyObject_CallObject(PyObject *callable_object,

Index: ceval.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/ceval.h,v
retrieving revision 2.43
retrieving revision 2.44
diff -C2 -d -r2.43 -r2.44
*** ceval.h	2001/07/16 02:29:45	2.43
--- ceval.h	2001/08/02 04:15:00	2.44
***************
*** 46,49 ****
--- 46,52 ----
  DL_IMPORT(int) Py_GetRecursionLimit(void);
  
+ DL_IMPORT(char *) PyEval_GetFuncName(PyObject *);
+ DL_IMPORT(char *) PyEval_GetFuncDesc(PyObject *);
+ 
  /* Interface for threads.
  

Index: classobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/classobject.h,v
retrieving revision 2.37
retrieving revision 2.38
diff -C2 -d -r2.37 -r2.38
*** classobject.h	2001/03/23 04:17:58	2.37
--- classobject.h	2001/08/02 04:15:00	2.38
***************
*** 48,55 ****
  extern DL_IMPORT(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *);
  
- extern DL_IMPORT(PyObject *) PyMethod_Function(PyObject *);
- extern DL_IMPORT(PyObject *) PyMethod_Self(PyObject *);
- extern DL_IMPORT(PyObject *) PyMethod_Class(PyObject *);
- 
  /* Macros for direct access to these values. Type checks are *not*
     done, so use with care. */
--- 48,51 ----

Index: dictobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/dictobject.h,v
retrieving revision 2.20
retrieving revision 2.21
diff -C2 -d -r2.20 -r2.21
*** dictobject.h	2000/09/01 23:29:26	2.20
--- dictobject.h	2001/08/02 04:15:00	2.21
***************
*** 8,14 ****
  /* Dictionary object type -- mapping from hashable object to object */
  
  extern DL_IMPORT(PyTypeObject) PyDict_Type;
  
! #define PyDict_Check(op) ((op)->ob_type == &PyDict_Type)
  
  extern DL_IMPORT(PyObject *) PyDict_New(void);
--- 8,88 ----
  /* Dictionary object type -- mapping from hashable object to object */
  
+ /*
+ There are three kinds of slots in the table:
+ 
+ 1. Unused.  me_key == me_value == NULL
+    Does not hold an active (key, value) pair now and never did.  Unused can
+    transition to Active upon key insertion.  This is the only case in which
+    me_key is NULL, and is each slot's initial state.
+ 
+ 2. Active.  me_key != NULL and me_key != dummy and me_value != NULL
+    Holds an active (key, value) pair.  Active can transition to Dummy upon
+    key deletion.  This is the only case in which me_value != NULL.
+ 
+ 3. Dummy.  me_key == dummy and me_value == NULL
+    Previously held an active (key, value) pair, but that was deleted and an
+    active pair has not yet overwritten the slot.  Dummy can transition to
+    Active upon key insertion.  Dummy slots cannot be made Unused again
+    (cannot have me_key set to NULL), else the probe sequence in case of
+    collision would have no way to know they were once active.
+ 
+ Note: .popitem() abuses the me_hash field of an Unused or Dummy slot to
+ hold a search finger.  The me_hash field of Unused or Dummy slots has no
+ meaning otherwise.
+ */
+ 
+ /* PyDict_MINSIZE is the minimum size of a dictionary.  This many slots are
+  * allocated directly in the dict object (in the ma_smalltable member).
+  * It must be a power of 2, and at least 4.  8 allows dicts with no more
+  * than 5 active entries to live in ma_smalltable (and so avoid an
+  * additional malloc); instrumentation suggested this suffices for the
+  * majority of dicts (consisting mostly of usually-small instance dicts and
+  * usually-small dicts created to pass keyword arguments).
+  */
+ #define PyDict_MINSIZE 8
+ 
+ typedef struct {
+ 	long me_hash;      /* cached hash code of me_key */
+ 	PyObject *me_key;
+ 	PyObject *me_value;
+ #ifdef USE_CACHE_ALIGNED
+ 	long	aligner;
+ #endif
+ } PyDictEntry;
+ 
+ /*
+ To ensure the lookup algorithm terminates, there must be at least one Unused
+ slot (NULL key) in the table.
+ The value ma_fill is the number of non-NULL keys (sum of Active and Dummy);
+ ma_used is the number of non-NULL, non-dummy keys (== the number of non-NULL
+ values == the number of Active items).
+ To avoid slowing down lookups on a near-full table, we resize the table when
+ it's two-thirds full.
+ */
+ typedef struct _dictobject PyDictObject;
+ struct _dictobject {
+ 	PyObject_HEAD
+ 	int ma_fill;  /* # Active + # Dummy */
+ 	int ma_used;  /* # Active */
+ 
+ 	/* The table contains ma_mask + 1 slots, and that's a power of 2.
+ 	 * We store the mask instead of the size because the mask is more
+ 	 * frequently needed.
+ 	 */
+ 	int ma_mask;
+ 
+ 	/* ma_table points to ma_smalltable for small tables, else to
+ 	 * additional malloc'ed memory.  ma_table is never NULL!  This rule
+ 	 * saves repeated runtime null-tests in the workhorse getitem and
+ 	 * setitem calls.
+ 	 */
+ 	PyDictEntry *ma_table;
+ 	PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash);
+ 	PyDictEntry ma_smalltable[PyDict_MINSIZE];
+ };
+ 
  extern DL_IMPORT(PyTypeObject) PyDict_Type;
  
! #define PyDict_Check(op) PyObject_TypeCheck(op, &PyDict_Type)
  
  extern DL_IMPORT(PyObject *) PyDict_New(void);
***************
*** 24,27 ****
--- 98,102 ----
  extern DL_IMPORT(int) PyDict_Size(PyObject *mp);
  extern DL_IMPORT(PyObject *) PyDict_Copy(PyObject *mp);
+ extern DL_IMPORT(int) PyDict_Update(PyObject *mp, PyObject *other);
  
  

Index: eval.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/eval.h,v
retrieving revision 2.14
retrieving revision 2.15
diff -C2 -d -r2.14 -r2.15
*** eval.h	2000/09/01 23:29:26	2.14
--- eval.h	2001/08/02 04:15:00	2.15
***************
*** 10,13 ****
--- 10,21 ----
  DL_IMPORT(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *);
  
+ DL_IMPORT(PyObject *) PyEval_EvalCodeEx(PyCodeObject *co,
+ 					PyObject *globals,
+ 					PyObject *locals,
+ 					PyObject **args, int argc,
+ 					PyObject **kwds, int kwdc,
+ 					PyObject **defs, int defc,
+ 					PyObject *closure);
+ 
  #ifdef __cplusplus
  }

Index: funcobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/funcobject.h,v
retrieving revision 2.23
retrieving revision 2.24
diff -C2 -d -r2.23 -r2.24
*** funcobject.h	2001/03/23 04:17:58	2.23
--- funcobject.h	2001/08/02 04:15:00	2.24
***************
*** 43,46 ****
--- 43,53 ----
  	(((PyFunctionObject *)func) -> func_closure)
  
+ /* The classmethod and staticmethod types lives here, too */
+ extern DL_IMPORT(PyTypeObject) PyClassMethod_Type;
+ extern DL_IMPORT(PyTypeObject) PyStaticMethod_Type;
+ 
+ extern DL_IMPORT(PyObject *) PyClassMethod_New(PyObject *);
+ extern DL_IMPORT(PyObject *) PyStaticMethod_New(PyObject *);
+ 
  #ifdef __cplusplus
  }

Index: listobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/listobject.h,v
retrieving revision 2.21
retrieving revision 2.22
diff -C2 -d -r2.21 -r2.22
*** listobject.h	2000/09/01 23:29:26	2.21
--- listobject.h	2001/08/02 04:15:00	2.22
***************
*** 27,31 ****
  extern DL_IMPORT(PyTypeObject) PyList_Type;
  
! #define PyList_Check(op) ((op)->ob_type == &PyList_Type)
  
  extern DL_IMPORT(PyObject *) PyList_New(int size);
--- 27,31 ----
  extern DL_IMPORT(PyTypeObject) PyList_Type;
  
! #define PyList_Check(op) PyObject_TypeCheck(op, &PyList_Type)
  
  extern DL_IMPORT(PyObject *) PyList_New(int size);

Index: modsupport.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/modsupport.h,v
retrieving revision 2.36
retrieving revision 2.37
diff -C2 -d -r2.36 -r2.37
*** modsupport.h	2001/01/25 22:13:34	2.36
--- modsupport.h	2001/08/02 04:15:00	2.37
***************
*** 23,28 ****
  extern DL_IMPORT(int) PyModule_AddStringConstant(PyObject *, char *, char *);
  
! #define PYTHON_API_VERSION 1010
! #define PYTHON_API_STRING "1010"
  /* The API version is maintained (independently from the Python version)
     so we can detect mismatches between the interpreter and dynamically
--- 23,28 ----
  extern DL_IMPORT(int) PyModule_AddStringConstant(PyObject *, char *, char *);
  
! #define PYTHON_API_VERSION 1011
! #define PYTHON_API_STRING "1011"
  /* The API version is maintained (independently from the Python version)
     so we can detect mismatches between the interpreter and dynamically
***************
*** 37,40 ****
--- 37,42 ----
     Please add a line or two to the top of this log for each API
     version change:
+ 
+    17-Jul-2001	GvR	1011	Descr-branch, just to be on the safe side
  
     25-Jan-2001  FLD     1010    Parameters added to PyCode_New() and

Index: object.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/object.h,v
retrieving revision 2.79
retrieving revision 2.80
diff -C2 -d -r2.79 -r2.80
*** object.h	2001/04/23 14:08:49	2.79
--- object.h	2001/08/02 04:15:00	2.80
***************
*** 203,206 ****
--- 203,211 ----
  typedef PyObject *(*getiterfunc) (PyObject *);
  typedef PyObject *(*iternextfunc) (PyObject *);
+ typedef PyObject *(*descrgetfunc) (PyObject *, PyObject *, PyObject *);
+ typedef int (*descrsetfunc) (PyObject *, PyObject *, PyObject *);
+ typedef int (*initproc)(PyObject *, PyObject *, PyObject *);
+ typedef PyObject *(*newfunc)(struct _typeobject *, PyObject *, PyObject *);
+ typedef PyObject *(*allocfunc)(struct _typeobject *, int);
  
  typedef struct _typeobject {
***************
*** 256,263 ****
  	iternextfunc tp_iternext;
  
  #ifdef COUNT_ALLOCS
  	/* these must be last and never explicitly initialized */
! 	int tp_alloc;
! 	int tp_free;
  	int tp_maxalloc;
  	struct _typeobject *tp_next;
--- 261,285 ----
  	iternextfunc tp_iternext;
  
+ 	/* Attribute descriptor and subclassing stuff */
+ 	struct PyMethodDef *tp_methods;
+ 	struct memberlist *tp_members;
+ 	struct getsetlist *tp_getset;
+ 	struct _typeobject *tp_base;
+ 	PyObject *tp_dict;
+ 	descrgetfunc tp_descr_get;
+ 	descrsetfunc tp_descr_set;
+ 	long tp_dictoffset;
+ 	initproc tp_init;
+ 	allocfunc tp_alloc;
+ 	newfunc tp_new;
+ 	destructor tp_free; /* Low-level free-memory routine */
+ 	PyObject *tp_bases;
+ 	PyObject *tp_mro; /* method resolution order */
+ 	PyObject *tp_defined;
+ 
  #ifdef COUNT_ALLOCS
  	/* these must be last and never explicitly initialized */
! 	int tp_allocs;
! 	int tp_frees;
  	int tp_maxalloc;
  	struct _typeobject *tp_next;
***************
*** 265,272 ****
  } PyTypeObject;
  
- extern DL_IMPORT(PyTypeObject) PyType_Type; /* The type of type objects */
  
! #define PyType_Check(op) ((op)->ob_type == &PyType_Type)
  
  /* Generic operations on objects */
  extern DL_IMPORT(int) PyObject_Print(PyObject *, FILE *, int);
--- 287,307 ----
  } PyTypeObject;
  
  
! /* Generic type check */
! extern DL_IMPORT(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *);
! #define PyObject_TypeCheck(ob, tp) \
! 	((ob)->ob_type == (tp) || PyType_IsSubtype((ob)->ob_type, (tp)))
  
+ extern DL_IMPORT(PyTypeObject) PyType_Type; /* Metatype */
+ extern DL_IMPORT(PyTypeObject) PyBaseObject_Type; /* Most base object type */
+ 
+ #define PyType_Check(op) PyObject_TypeCheck(op, &PyType_Type)
+ 
+ extern DL_IMPORT(int) PyType_InitDict(PyTypeObject *);
+ extern DL_IMPORT(PyObject *) PyType_GenericAlloc(PyTypeObject *, int);
+ extern DL_IMPORT(PyObject *) PyType_GenericNew(PyTypeObject *,
+ 					       PyObject *, PyObject *);
+ extern DL_IMPORT(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *);
+ 
  /* Generic operations on objects */
  extern DL_IMPORT(int) PyObject_Print(PyObject *, FILE *, int);
***************
*** 284,287 ****
--- 319,326 ----
  extern DL_IMPORT(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *);
  extern DL_IMPORT(int) PyObject_HasAttr(PyObject *, PyObject *);
+ extern DL_IMPORT(PyObject **) _PyObject_GetDictPtr(PyObject *);
+ extern DL_IMPORT(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *);
+ extern DL_IMPORT(int) PyObject_GenericSetAttr(PyObject *,
+ 					      PyObject *, PyObject *);
  extern DL_IMPORT(long) PyObject_Hash(PyObject *);
  extern DL_IMPORT(int) PyObject_IsTrue(PyObject *);
***************
*** 358,361 ****
--- 397,412 ----
  #define Py_TPFLAGS_HAVE_ITER (1L<<7)
  
+ /* Experimental stuff for healing the type/class split */
+ #define Py_TPFLAGS_HAVE_CLASS (1L<<8)
+ 
+ /* Set if the type object is dynamically allocated */
+ #define Py_TPFLAGS_HEAPTYPE (1L<<9)
+ 
+ /* Set if the type allows subclassing */
+ #define Py_TPFLAGS_BASETYPE (1L<<10)
+ 
+ /* Set if the type's __dict__ may change */
+ #define Py_TPFLAGS_DYNAMICTYPE (1L<<11)
+ 
  #define Py_TPFLAGS_DEFAULT  ( \
                               Py_TPFLAGS_HAVE_GETCHARBUFFER | \
***************
*** 365,368 ****
--- 416,420 ----
                               Py_TPFLAGS_HAVE_WEAKREFS | \
                               Py_TPFLAGS_HAVE_ITER | \
+                              Py_TPFLAGS_HAVE_CLASS | \
                              0)
  
***************
*** 413,418 ****
  #ifndef Py_TRACE_REFS
  #ifdef COUNT_ALLOCS
! #define _Py_Dealloc(op) ((op)->ob_type->tp_free++, (*(op)->ob_type->tp_dealloc)((PyObject *)(op)))
! #define _Py_ForgetReference(op) ((op)->ob_type->tp_free++)
  #else /* !COUNT_ALLOCS */
  #define _Py_Dealloc(op) (*(op)->ob_type->tp_dealloc)((PyObject *)(op))
--- 465,470 ----
  #ifndef Py_TRACE_REFS
  #ifdef COUNT_ALLOCS
! #define _Py_Dealloc(op) ((op)->ob_type->tp_frees++, (*(op)->ob_type->tp_dealloc)((PyObject *)(op)))
! #define _Py_ForgetReference(op) ((op)->ob_type->tp_frees++)
  #else /* !COUNT_ALLOCS */
  #define _Py_Dealloc(op) (*(op)->ob_type->tp_dealloc)((PyObject *)(op))

Index: objimpl.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/objimpl.h,v
retrieving revision 2.34
retrieving revision 2.35
diff -C2 -d -r2.34 -r2.35
*** objimpl.h	2001/03/22 18:26:47	2.34
--- objimpl.h	2001/08/02 04:15:00	2.35
***************
*** 237,241 ****
  #define PyObject_AS_GC(op) (op)
  #define PyObject_FROM_GC(op) (op)
!  
  #else
  
--- 237,247 ----
  #define PyObject_AS_GC(op) (op)
  #define PyObject_FROM_GC(op) (op)
! #define PyType_IS_GC(t) 0
! #define PyObject_IS_GC(o) 0
! #define PyObject_AS_GC(o) (o)
! #define PyObject_FROM_GC(o) (o)
! #define PyType_BASICSIZE(t) ((t)->tp_basicsize)
! #define PyType_SET_BASICSIZE(t, s) ((t)->tp_basicsize = (s))
! 
  #else
  
***************
*** 269,272 ****
--- 275,285 ----
  /* Get the object given the PyGC_Head */
  #define PyObject_FROM_GC(g) ((PyObject *)(((PyGC_Head *)g)+1))
+ 
+ /* Calculate tp_basicsize excluding PyGC_HEAD_SIZE if applicable */
+ #define PyType_BASICSIZE(t) (!PyType_IS_GC(t) ? (t)->tp_basicsize : \
+ 			     (t)->tp_basicsize - PyGC_HEAD_SIZE)
+ #define PyType_SET_BASICSIZE(t, s) (!PyType_IS_GC(t) ? \
+ 			((t)->tp_basicsize = (s)) : \
+ 			((t)->tp_basicsize  = (s) + PyGC_HEAD_SIZE))
  
  extern DL_IMPORT(void) _PyGC_Dump(PyGC_Head *);

Index: patchlevel.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v
retrieving revision 2.50
retrieving revision 2.51
diff -C2 -d -r2.50 -r2.51
*** patchlevel.h	2001/04/18 04:31:01	2.50
--- patchlevel.h	2001/08/02 04:15:00	2.51
***************
*** 24,34 ****
  #define PY_MICRO_VERSION	0
  #define PY_RELEASE_LEVEL	PY_RELEASE_LEVEL_ALPHA
! #define PY_RELEASE_SERIAL	0
  
  /* Version as a string */
! #define PY_VERSION		"2.2a0"
  
  /* Historic */
! #define PATCHLEVEL		"2.2a0"
  
  /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
--- 24,34 ----
  #define PY_MICRO_VERSION	0
  #define PY_RELEASE_LEVEL	PY_RELEASE_LEVEL_ALPHA
! #define PY_RELEASE_SERIAL	1
  
  /* Version as a string */
! #define PY_VERSION		"2.2a1"
  
  /* Historic */
! #define PATCHLEVEL		"2.2a1"
  
  /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.

Index: pythonrun.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v
retrieving revision 2.43
retrieving revision 2.44
diff -C2 -d -r2.43 -r2.44
*** pythonrun.h	2001/07/16 05:37:24	2.43
--- pythonrun.h	2001/08/02 04:15:00	2.44
***************
*** 93,100 ****
  DL_IMPORT(PyObject *) _PySys_Init(void);
  DL_IMPORT(void) _PyImport_Init(void);
! DL_IMPORT(void) init_exceptions(void);
  
  /* Various internal finalizers */
! DL_IMPORT(void) fini_exceptions(void);
  DL_IMPORT(void) _PyImport_Fini(void);
  DL_IMPORT(void) PyMethod_Fini(void);
--- 93,100 ----
  DL_IMPORT(PyObject *) _PySys_Init(void);
  DL_IMPORT(void) _PyImport_Init(void);
! DL_IMPORT(void) _PyExc_Init(void);
  
  /* Various internal finalizers */
! DL_IMPORT(void) _PyExc_Fini(void);
  DL_IMPORT(void) _PyImport_Fini(void);
  DL_IMPORT(void) PyMethod_Fini(void);