mirror of
https://github.com/python/cpython.git
synced 2025-12-10 11:00:14 +00:00
Move docstrings for long.to_bytes and long.from_bytes after the corresponding functions.
This commit is contained in:
parent
167543c701
commit
078c2532e0
1 changed files with 27 additions and 27 deletions
|
|
@ -4393,25 +4393,6 @@ long_is_finite(PyObject *v)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(long_to_bytes_doc,
|
|
||||||
"int.to_bytes(length, byteorder, *, signed=False) -> bytes\n\
|
|
||||||
\n\
|
|
||||||
Return an array of bytes representing an integer.\n\
|
|
||||||
\n\
|
|
||||||
The integer is represented using length bytes. An OverflowError is\n\
|
|
||||||
raised if the integer is not representable with the given number of\n\
|
|
||||||
bytes.\n\
|
|
||||||
\n\
|
|
||||||
The byteorder argument determines the byte order used to represent the\n\
|
|
||||||
integer. If byteorder is 'big', the most significant byte is at the\n\
|
|
||||||
beginning of the byte array. If byteorder is 'little', the most\n\
|
|
||||||
significant byte is at the end of the byte array. To request the native\n\
|
|
||||||
byte order of the host system, use `sys.byteorder' as the byte order value.\n\
|
|
||||||
\n\
|
|
||||||
The signed keyword-only argument determines whether two's complement is\n\
|
|
||||||
used to represent the integer. If signed is False and a negative integer\n\
|
|
||||||
is given, an OverflowError is raised.");
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
long_to_bytes(PyLongObject *v, PyObject *args, PyObject *kwds)
|
long_to_bytes(PyLongObject *v, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
|
|
@ -4475,14 +4456,14 @@ long_to_bytes(PyLongObject *v, PyObject *args, PyObject *kwds)
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(long_from_bytes_doc,
|
PyDoc_STRVAR(long_to_bytes_doc,
|
||||||
"int.from_bytes(bytes, byteorder, *, signed=False) -> int\n\
|
"int.to_bytes(length, byteorder, *, signed=False) -> bytes\n\
|
||||||
\n\
|
\n\
|
||||||
Return the integer represented by the given array of bytes.\n\
|
Return an array of bytes representing an integer.\n\
|
||||||
\n\
|
\n\
|
||||||
The bytes argument must either support the buffer protocol or be an\n\
|
The integer is represented using length bytes. An OverflowError is\n\
|
||||||
iterable object producing bytes. Bytes and bytearray are examples of\n\
|
raised if the integer is not representable with the given number of\n\
|
||||||
built-in objects that support the buffer protocol.\n\
|
bytes.\n\
|
||||||
\n\
|
\n\
|
||||||
The byteorder argument determines the byte order used to represent the\n\
|
The byteorder argument determines the byte order used to represent the\n\
|
||||||
integer. If byteorder is 'big', the most significant byte is at the\n\
|
integer. If byteorder is 'big', the most significant byte is at the\n\
|
||||||
|
|
@ -4490,8 +4471,9 @@ beginning of the byte array. If byteorder is 'little', the most\n\
|
||||||
significant byte is at the end of the byte array. To request the native\n\
|
significant byte is at the end of the byte array. To request the native\n\
|
||||||
byte order of the host system, use `sys.byteorder' as the byte order value.\n\
|
byte order of the host system, use `sys.byteorder' as the byte order value.\n\
|
||||||
\n\
|
\n\
|
||||||
The signed keyword-only argument indicates whether two's complement is\n\
|
The signed keyword-only argument determines whether two's complement is\n\
|
||||||
used to represent the integer.");
|
used to represent the integer. If signed is False and a negative integer\n\
|
||||||
|
is given, an OverflowError is raised.");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
long_from_bytes(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
long_from_bytes(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
|
|
@ -4573,6 +4555,24 @@ long_from_bytes(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
return long_obj;
|
return long_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(long_from_bytes_doc,
|
||||||
|
"int.from_bytes(bytes, byteorder, *, signed=False) -> int\n\
|
||||||
|
\n\
|
||||||
|
Return the integer represented by the given array of bytes.\n\
|
||||||
|
\n\
|
||||||
|
The bytes argument must either support the buffer protocol or be an\n\
|
||||||
|
iterable object producing bytes. Bytes and bytearray are examples of\n\
|
||||||
|
built-in objects that support the buffer protocol.\n\
|
||||||
|
\n\
|
||||||
|
The byteorder argument determines the byte order used to represent the\n\
|
||||||
|
integer. If byteorder is 'big', the most significant byte is at the\n\
|
||||||
|
beginning of the byte array. If byteorder is 'little', the most\n\
|
||||||
|
significant byte is at the end of the byte array. To request the native\n\
|
||||||
|
byte order of the host system, use `sys.byteorder' as the byte order value.\n\
|
||||||
|
\n\
|
||||||
|
The signed keyword-only argument indicates whether two's complement is\n\
|
||||||
|
used to represent the integer.");
|
||||||
|
|
||||||
static PyMethodDef long_methods[] = {
|
static PyMethodDef long_methods[] = {
|
||||||
{"conjugate", (PyCFunction)long_long, METH_NOARGS,
|
{"conjugate", (PyCFunction)long_long, METH_NOARGS,
|
||||||
"Returns self, the complex conjugate of any int."},
|
"Returns self, the complex conjugate of any int."},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue