[Python-checkins] python/dist/src/Modules operator.c,2.26,2.27

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Sat, 18 Jan 2003 15:22:22 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv12504/Modules

Modified Files:
	operator.c 
Log Message:
SF patch #670423: Add missing identity tests to operator.c



Index: operator.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/operator.c,v
retrieving revision 2.26
retrieving revision 2.27
diff -C2 -d -r2.26 -r2.27
*** operator.c	3 Jan 2003 08:24:58 -0000	2.26
--- operator.c	18 Jan 2003 23:22:20 -0000	2.27
***************
*** 109,112 ****
--- 109,134 ----
  
  static PyObject*
+ is_(PyObject *s, PyObject *a)
+ {
+ 	PyObject *a1, *a2, *result = NULL;
+ 	if (PyArg_UnpackTuple(a,"is_", 2, 2, &a1, &a2)) {
+ 		result = (a1 == a2) ? Py_True : Py_False;
+ 		Py_INCREF(result);
+ 	}
+ 	return result;
+ }
+ 
+ static PyObject*
+ is_not(PyObject *s, PyObject *a)
+ {
+ 	PyObject *a1, *a2, *result = NULL;
+ 	if (PyArg_UnpackTuple(a,"is_not", 2, 2, &a1, &a2)) {
+ 		result = (a1 != a2) ? Py_True : Py_False;
+ 		Py_INCREF(result);
+ 	}
+ 	return result;
+ }
+ 
+ static PyObject*
  op_getslice(PyObject *s, PyObject *a)
  {
***************
*** 183,186 ****
--- 205,210 ----
   "isMappingType(a) -- Return True if a has a mapping type, False otherwise.")
  
+ spam1(is_, "is_(a, b) -- Same as a is b.")
+ spam1(is_not, "is_not(a, b) -- Same as a is not b.")
  spam2(add,__add__, "add(a, b) -- Same as a + b.")
  spam2(sub,__sub__, "sub(a, b) -- Same as a - b.")