summaryrefslogtreecommitdiffstats
path: root/Objects/floatobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-09-19 01:25:16 (GMT)
committerGuido van Rossum <guido@python.org>2001-09-19 01:25:16 (GMT)
commit1952e388ca63b8eaa090bef966dd538f78ece208 (patch)
tree31afd318ac859dfbe337d2cf6e11fc6c10bcb45f /Objects/floatobject.c
parentd5d8e4a43632d9d4ec9f6fb23f7405c4f0678617 (diff)
downloadcpython-1952e388ca63b8eaa090bef966dd538f78ece208.zip
cpython-1952e388ca63b8eaa090bef966dd538f78ece208.tar.gz
cpython-1952e388ca63b8eaa090bef966dd538f78ece208.tar.bz2
Add additional coercion support for "self subtypes" to int, long,
float (compare the recent checkin to complex). Added tests for these.
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r--Objects/floatobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index b9a5e1b..2de5535 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -590,6 +590,11 @@ float_coerce(PyObject **pv, PyObject **pw)
Py_INCREF(*pv);
return 0;
}
+ else if (PyFloat_Check(*pw)) {
+ Py_INCREF(*pv);
+ Py_INCREF(*pw);
+ return 0;
+ }
return 1; /* Can't do it */
}