[Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.181,2.181.2.1
Moshe Zadka
moshez@users.sourceforge.net
Fri, 30 Mar 2001 10:27:13 -0800
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv12593/Python
Modified Files:
Tag: release20-maint
bltinmodule.c
Log Message:
Fixed bug in complex(). No SF id
Index: bltinmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.181
retrieving revision 2.181.2.1
diff -C2 -r2.181 -r2.181.2.1
*** bltinmodule.c 2000/09/26 05:46:01 2.181
--- bltinmodule.c 2001/03/30 18:27:10 2.181.2.1
***************
*** 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);