diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -78,25 +78,27 @@ All integers are implemented as "long" i Return a new :c:type:`PyLongObject` object from the integer part of *v*, or *NULL* on failure. .. c:function:: PyObject* PyLong_FromString(char *str, char **pend, int base) Return a new :c:type:`PyLongObject` based on the string value in *str*, which - is interpreted according to the radix in *base*. If *pend* is non-*NULL*, - *\*pend* will point to the first character in *str* which follows the - representation of the number. If *base* is ``0``, the radix will be - determined based on the leading characters of *str*: if *str* starts with - ``'0x'`` or ``'0X'``, radix 16 will be used; if *str* starts with ``'0o'`` or - ``'0O'``, radix 8 will be used; if *str* starts with ``'0b'`` or ``'0B'``, - radix 2 will be used; otherwise radix 10 will be used. If *base* is not - ``0``, it must be between ``2`` and ``36``, inclusive. Leading spaces are - ignored. If there are no digits, :exc:`ValueError` will be raised. + is interpreted according to the radix in *base*. If *base* is ``0``, the + radix will be determined based on the leading characters of *str*: if *str* + starts with ``'0x'`` or ``'0X'``, radix 16 will be used; if *str* starts with + ``'0o'`` or ``'0O'``, radix 8 will be used; if *str* starts with ``'0b'`` or + ``'0B'``, radix 2 will be used; otherwise radix 10 will be used. If *base* + is not ``0``, it must be between ``2`` and ``36``, inclusive. + + Leading spaces are ignored, and the representation of the number must be + terminted by a null byte. If *pend* is non-*NULL*, then *\*pend* will + point to the location of the terminating null byte. If there are no + digits, :exc:`ValueError` will be raised. .. c:function:: PyObject* PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base) Convert a sequence of Unicode digits to a Python integer value. The Unicode string is first encoded to a byte string using :c:func:`PyUnicode_EncodeDecimal` and then converted using :c:func:`PyLong_FromString`.