mirror of
https://github.com/python/cpython.git
synced 2025-10-03 13:45:29 +00:00
[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 e244401ce5
)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
This commit is contained in:
parent
5964b12829
commit
bab79942c4
1 changed files with 4 additions and 0 deletions
|
@ -93,6 +93,10 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
|
|||
underscores after a base specifier and between digits are ignored. If there
|
||||
are no digits, :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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue