diff options
author | Gregory P. Smith <greg@krypto.org> | 2023-01-24 05:20:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-24 05:20:53 (GMT) |
commit | e244401ce508ad391295beb636e499fcc6797a2a (patch) | |
tree | 5bf6c0508b599543bf06fb122e21de3302a1259f /Doc/c-api | |
parent | b724ac2fe7fbb5a7a33d639cad8e748f17b325e0 (diff) | |
download | cpython-e244401ce508ad391295beb636e499fcc6797a2a.zip cpython-e244401ce508ad391295beb636e499fcc6797a2a.tar.gz cpython-e244401ce508ad391295beb636e499fcc6797a2a.tar.bz2 |
[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
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/long.rst | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index 4f6f865..41b5632 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -94,6 +94,10 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate. ignored. If there are no digits or *str* is not NULL-terminated following the digits and trailing whitespace, :exc:`ValueError` will be raised. + .. seealso:: Python methods :meth:`int.to_bytes` and :meth:`int.from_bytes` + to convert a :c:type:`PyLongObject` to/from an array of bytes in base + ``256``. You can call those from C using :c:func:`PyObject_CallMethod`. + .. c:function:: PyObject* PyLong_FromUnicodeObject(PyObject *u, int base) |