summaryrefslogtreecommitdiff
path: root/Objects/abstract.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-06-22 11:39:13 +0000
committerRaymond Hettinger <python@rcn.com>2008-06-22 11:39:13 +0000
commitad1e89aacefd1df9dc63e6ab5989ea664da8a438 (patch)
tree63015c743f755cb40f7b5baacf9f60b4d5aa6515 /Objects/abstract.c
parent3b2bfb95e65f8946074dcc1275c44c204333040f (diff)
downloadcpython-ad1e89aacefd1df9dc63e6ab5989ea664da8a438.tar.gz
Merge 64438: hex/oct/bin can show floats exactly.
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r--Objects/abstract.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 60a5e849cf..0d40d17d65 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -1451,8 +1451,11 @@ PyObject *
PyNumber_ToBase(PyObject *n, int base)
{
PyObject *res = NULL;
- PyObject *index = PyNumber_Index(n);
+ PyObject *index;
+ if (PyFloat_Check(n))
+ return _float_to_base(n, base);
+ index = PyNumber_Index(n);
if (!index)
return NULL;
if (PyLong_Check(index))