Skip to content

Commit bab7994

Browse files
[docs] Mention how to get/set a bigint PyLong via the C API (GH-101270)
We don't need direct C APIs to get at a bigint representation of PyLong but we do want the few people who need to understand how. Additional Author: CAM-Gerlach (cherry picked from commit e244401) Co-authored-by: Gregory P. Smith <[email protected]>
1 parent 5964b12 commit bab7994

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Doc/c-api/long.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
9393
underscores after a base specifier and between digits are ignored. If there
9494
are no digits, :exc:`ValueError` will be raised.
9595
96+
.. seealso:: Python methods :meth:`int.to_bytes` and :meth:`int.from_bytes`
97+
to convert a :c:type:`PyLongObject` to/from an array of bytes in base
98+
``256``. You can call those from C using :c:func:`PyObject_CallMethod`.
99+
96100
97101
.. c:function:: PyObject* PyLong_FromUnicodeObject(PyObject *u, int base)
98102

0 commit comments

Comments
 (0)