diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-01-30 18:06:17 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-01-30 18:06:17 (GMT) |
commit | 078c2532e0e039cd908b77d15f02d70d634753ab (patch) | |
tree | 74fcee7523493a3c950694f5273302accfc53c2e /Objects/longobject.c | |
parent | 167543c701ba6928ffcf7ea228143e6917beb501 (diff) | |
download | cpython-078c2532e0e039cd908b77d15f02d70d634753ab.zip cpython-078c2532e0e039cd908b77d15f02d70d634753ab.tar.gz cpython-078c2532e0e039cd908b77d15f02d70d634753ab.tar.bz2 |
Move docstrings for long.to_bytes and long.from_bytes after the corresponding functions.
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r-- | Objects/longobject.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index db7a91c..ce87084 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -4393,25 +4393,6 @@ long_is_finite(PyObject *v) #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 * long_to_bytes(PyLongObject *v, PyObject *args, PyObject *kwds) { @@ -4475,14 +4456,14 @@ long_to_bytes(PyLongObject *v, PyObject *args, PyObject *kwds) return bytes; } -PyDoc_STRVAR(long_from_bytes_doc, -"int.from_bytes(bytes, byteorder, *, signed=False) -> int\n\ +PyDoc_STRVAR(long_to_bytes_doc, +"int.to_bytes(length, byteorder, *, signed=False) -> bytes\n\ \n\ -Return the integer represented by the given array of bytes.\n\ +Return an array of bytes representing an integer.\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\ +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\ @@ -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\ 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."); +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 * 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; } +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[] = { {"conjugate", (PyCFunction)long_long, METH_NOARGS, "Returns self, the complex conjugate of any int."}, |