[Python-checkins] CVS: python/dist/src/Objects complexobject.c,2.45,2.46
Guido van Rossum
gvanrossum@users.sourceforge.net
Tue, 18 Sep 2001 18:13:12 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv19545
Modified Files:
complexobject.c
Log Message:
complex_coerce(): add explicit PyComplex_Check() test. Previously,
complex_coerce() would never be called with a complex argument,
because PyNumber_Coerce[Ex] doesn't bother calling the type's coercion
method if the values already have the same type. But now, of course,
it's possible to pass an instance of a complex *subtype*, and those
must be accepted.
Index: complexobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v
retrieving revision 2.45
retrieving revision 2.46
diff -C2 -d -r2.45 -r2.46
*** complexobject.c 2001/09/12 19:12:49 2.45
--- complexobject.c 2001/09/19 01:13:10 2.46
***************
*** 539,542 ****
--- 539,547 ----
return 0;
}
+ else if (PyComplex_Check(*pw)) {
+ Py_INCREF(*pv);
+ Py_INCREF(*pw);
+ return 0;
+ }
return 1; /* Can't do it */
}