[Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.76,2.77
Guido van Rossum
gvanrossum@users.sourceforge.net
Fri, 28 Sep 2001 15:58:54 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv32432
Modified Files:
typeobject.c
Log Message:
Ouch. The wrapper for __rpow__ was the same as for __pow__, resulting
in bizarre outcomes. Test forthcoming.
Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.76
retrieving revision 2.77
diff -C2 -d -r2.76 -r2.77
*** typeobject.c 2001/09/27 20:30:07 2.76
--- typeobject.c 2001/09/28 22:58:52 2.77
***************
*** 1889,1892 ****
--- 1889,1906 ----
}
+ static PyObject *
+ wrap_ternaryfunc_r(PyObject *self, PyObject *args, void *wrapped)
+ {
+ ternaryfunc func = (ternaryfunc)wrapped;
+ PyObject *other;
+ PyObject *third = Py_None;
+
+ /* Note: This wrapper only works for __pow__() */
+
+ if (!PyArg_ParseTuple(args, "O|O", &other, &third))
+ return NULL;
+ return (*func)(other, self, third);
+ }
+
#undef TERNARY
#define TERNARY(NAME, OP) \
***************
*** 1896,1900 ****
"x.__" #NAME "__(y, z) <==> " #OP}, \
{"__r" #NAME "__", \
! (wrapperfunc)wrap_ternaryfunc, \
"y.__r" #NAME "__(x, z) <==> " #OP}, \
{0} \
--- 1910,1914 ----
"x.__" #NAME "__(y, z) <==> " #OP}, \
{"__r" #NAME "__", \
! (wrapperfunc)wrap_ternaryfunc_r, \
"y.__r" #NAME "__(x, z) <==> " #OP}, \
{0} \