summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/number.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/c-api/number.rst')
-rw-r--r--Doc/c-api/number.rst11
1 files changed, 11 insertions, 0 deletions
diff --git a/Doc/c-api/number.rst b/Doc/c-api/number.rst
index 6c73bfa..187fe73 100644
--- a/Doc/c-api/number.rst
+++ b/Doc/c-api/number.rst
@@ -259,6 +259,17 @@ Number Protocol
TypeError exception raised on failure.
+.. cfunction:: PyObject* PyNumber_ToBase(PyObject *n, int base)
+
+ Returns the the integer *n* converted to *base* as a string with a base
+ marker of ``'0b'``, ``'0o'``, or ``'0x'`` if appended applicable. When
+ *base* is not 2, 8, 10, or 16, the format is ``'x#num'`` where x is the
+ base. If *n* is not an int object, it is converted with
+ :cfunc:`PyNumber_Index` first.
+
+ .. versionadded:: 2.6
+
+
.. cfunction:: Py_ssize_t PyNumber_AsSsize_t(PyObject *o, PyObject *exc)
Returns *o* converted to a Py_ssize_t value if *o* can be interpreted as an