[Python-checkins] python/dist/src/Modules operator.c,2.23,2.24

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Sun, 18 Aug 2002 20:19:11 -0700


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

Modified Files:
	operator.c 
Log Message:
Added __pow__(a,b) to the operator module. Completes the pattern of
all operators having a counterpart in the operator module.

Closes SF bug #577513.


Index: operator.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/operator.c,v
retrieving revision 2.23
retrieving revision 2.24
diff -C2 -d -r2.23 -r2.24
*** operator.c	13 Aug 2002 22:20:41 -0000	2.23
--- operator.c	19 Aug 2002 03:19:09 -0000	2.24
***************
*** 103,106 ****
--- 103,115 ----
  
  static PyObject*
+ op_pow(PyObject *s, PyObject *a)
+ {
+ 	PyObject *a1, *a2;
+ 	if (PyArg_ParseTuple(a,"OO:pow",&a1,&a2))
+ 		return PyNumber_Power(a1, a2, Py_None);
+ 	return NULL;
+ }
+ 
+ static PyObject*
  op_getslice(PyObject *s, PyObject *a)
  {
***************
*** 200,203 ****
--- 209,213 ----
  spam2(delitem,__delitem__,
   "delitem(a, b) -- Same as del a[b].")
+ spam2(pow,__pow__, "pow(a, b) -- Same as a**b.")
  spam2(getslice,__getslice__,
   "getslice(a, b, c) -- Same as a[b:c].")