summaryrefslogtreecommitdiff
path: root/Objects/abstract.c
diff options
context:
space:
mode:
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))