[Python-checkins] CVS: python/dist/src/Include object.h,2.66,2.67

Neil Schemenauer python-dev@python.org
Wed, 03 Jan 2001 17:31:52 -0800


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

Modified Files:
	object.h 
Log Message:
- Add nb_cmp slot for new style nubmers.
- Define type flag for new style numbers.
- Add Py_NotImplemented.


Index: object.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/object.h,v
retrieving revision 2.66
retrieving revision 2.67
diff -C2 -r2.66 -r2.67
*** object.h	2000/09/10 01:02:41	2.66
--- object.h	2001/01/04 01:31:50	2.67
***************
*** 120,123 ****
--- 120,128 ----
  
  typedef struct {
+ 	/* For old style numbers all arguments are guaranteed to be of the
+ 	   object's type (modulo coercion hacks that is); new style numbers
+ 	   should check both arguments for proper type and implement the
+ 	   necessary conversions in the slots themselves. */
+ 
  	binaryfunc nb_add;
  	binaryfunc nb_subtract;
***************
*** 154,157 ****
--- 159,168 ----
  	binaryfunc nb_inplace_xor;
  	binaryfunc nb_inplace_or;
+ 
+ 	/* New style number slots; these are only used the
+ 	   Py_TPFLAGS_NEWSTYLENUMBER flag is set */
+ 
+ 	binaryfunc nb_cmp; /* XXX this should be richcmpfunc */
+ 
  } PyNumberMethods;
  
***************
*** 323,326 ****
--- 334,340 ----
  #define Py_TPFLAGS_HAVE_INPLACEOPS (1L<<3)
  
+ /* PyNumberMethods do their own coercion */
+ #define Py_TPFLAGS_NEWSTYLENUMBER (1L<<4)
+ 
  #define Py_TPFLAGS_DEFAULT  (Py_TPFLAGS_HAVE_GETCHARBUFFER | \
                               Py_TPFLAGS_HAVE_SEQUENCE_IN | \
***************
*** 435,438 ****
--- 449,460 ----
  #define Py_None (&_Py_NoneStruct)
  
+ /*
+ Py_NotImplemented is a singleton used to signal that an operation is
+ not implemented for a given type combination.
+ */
+ 
+ extern DL_IMPORT(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */
+ 
+ #define Py_NotImplemented (&_Py_NotImplementedStruct)
  
  /*