From 4cd5c9d4b774f0e44b426769abf4978f63ede61d Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Mon, 8 Jul 2024 08:43:17 +0300 Subject: [PATCH 1/2] gh-121477: mention new PyLong_*Bytes() functions in PyLong_FromString() --- Doc/c-api/long.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index 42162914c0aec8..a43a46a55a3355 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -94,9 +94,9 @@ 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`. + .. seealso:: :c:func:`PyLong_AsNativeBytes()` and + :c:func:`PyLong_FromNativeBytes()` functions could be used to convert + a :c:type:`PyLongObject` to/from an array of bytes in base ``256``. .. c:function:: PyObject* PyLong_FromUnicodeObject(PyObject *u, int base) From 8e2adb7fa163d84909bca5bc39a4280700dc5fb0 Mon Sep 17 00:00:00 2001 From: Kumar Aditya Date: Sat, 17 Aug 2024 14:25:48 +0530 Subject: [PATCH 2/2] Update Doc/c-api/long.rst --- Doc/c-api/long.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index a43a46a55a3355..8cb48670f6c568 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -95,7 +95,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate. digits and trailing whitespace, :exc:`ValueError` will be raised. .. seealso:: :c:func:`PyLong_AsNativeBytes()` and - :c:func:`PyLong_FromNativeBytes()` functions could be used to convert + :c:func:`PyLong_FromNativeBytes()` functions can be used to convert a :c:type:`PyLongObject` to/from an array of bytes in base ``256``.