[Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.191,2.192
Guido van Rossum
gvanrossum@users.sourceforge.net
Thu, 18 Jan 2001 18:12:01 -0800
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv7749
Modified Files:
bltinmodule.c
Log Message:
Fix for the bug in complex() just reported by Ping.
Index: bltinmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.191
retrieving revision 2.192
diff -C2 -r2.191 -r2.192
*** bltinmodule.c 2001/01/17 17:09:53 2.191
--- bltinmodule.c 2001/01/19 02:11:59 2.192
***************
*** 592,596 ****
}
else {
! tmp = (*nbr->nb_float)(r);
if (own_r) {
Py_DECREF(r);
--- 592,596 ----
}
else {
! tmp = PyNumber_Float(r);
if (own_r) {
Py_DECREF(r);
***************
*** 598,601 ****
--- 598,607 ----
if (tmp == NULL)
return NULL;
+ if (!PyFloat_Check(tmp)) {
+ PyErr_SetString(PyExc_TypeError,
+ "float(r) didn't return a float");
+ Py_DECREF(tmp);
+ return NULL;
+ }
cr.real = PyFloat_AsDouble(tmp);
Py_DECREF(tmp);