summaryrefslogtreecommitdiffstats
path: root/Objects/abstract.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r--Objects/abstract.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 6e63852..d43bb6a 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -969,6 +969,22 @@ PyNumber_Float(PyObject *o)
return PyFloat_FromString(o);
}
+
+PyObject *
+PyNumber_ToBase(PyObject *n, int base)
+{
+ PyObject *res;
+ PyObject *index = PyNumber_Index(n);
+
+ if (!index)
+ return NULL;
+ assert(PyLong_Check(index));
+ res = _PyLong_Format(index, base);
+ Py_DECREF(index);
+ return res;
+}
+
+
/* Operations on sequences */
int