Skip to content

Commit e244401

Browse files
authored
[docs] Mention how to get/set a bigint PyLong via the C API (#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
1 parent b724ac2 commit e244401

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Doc/c-api/long.rst

+4
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
9494
ignored. If there are no digits or *str* is not NULL-terminated following the
9595
digits and trailing whitespace, :exc:`ValueError` will be raised.
9696
97+
.. seealso:: Python methods :meth:`int.to_bytes` and :meth:`int.from_bytes`
98+
to convert a :c:type:`PyLongObject` to/from an array of bytes in base
99+
``256``. You can call those from C using :c:func:`PyObject_CallMethod`.
100+
97101
98102
.. c:function:: PyObject* PyLong_FromUnicodeObject(PyObject *u, int base)
99103

0 commit comments

Comments
 (0)