#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
# include "pycore_gc.h"
# include "pycore_runtime.h"
#endif
#include "pycore_abstract.h"
#include "pycore_modsupport.h"
static PyObject *
long_new_impl(PyTypeObject *type, PyObject *x, PyObject *obase);
static PyObject *
long_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{ … }
PyDoc_STRVAR(int___getnewargs____doc__,
"__getnewargs__($self, /)\n"
"--\n"
"\n");
#define INT___GETNEWARGS___METHODDEF …
static PyObject *
int___getnewargs___impl(PyObject *self);
static PyObject *
int___getnewargs__(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
PyDoc_STRVAR(int___format____doc__,
"__format__($self, format_spec, /)\n"
"--\n"
"\n"
"Convert to a string according to format_spec.");
#define INT___FORMAT___METHODDEF …
static PyObject *
int___format___impl(PyObject *self, PyObject *format_spec);
static PyObject *
int___format__(PyObject *self, PyObject *arg)
{ … }
PyDoc_STRVAR(int___round____doc__,
"__round__($self, ndigits=None, /)\n"
"--\n"
"\n"
"Rounding an Integral returns itself.\n"
"\n"
"Rounding with an ndigits argument also returns an integer.");
#define INT___ROUND___METHODDEF …
static PyObject *
int___round___impl(PyObject *self, PyObject *o_ndigits);
static PyObject *
int___round__(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
{ … }
PyDoc_STRVAR(int___sizeof____doc__,
"__sizeof__($self, /)\n"
"--\n"
"\n"
"Returns size in memory, in bytes.");
#define INT___SIZEOF___METHODDEF …
static Py_ssize_t
int___sizeof___impl(PyObject *self);
static PyObject *
int___sizeof__(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
PyDoc_STRVAR(int_bit_length__doc__,
"bit_length($self, /)\n"
"--\n"
"\n"
"Number of bits necessary to represent self in binary.\n"
"\n"
">>> bin(37)\n"
"\'0b100101\'\n"
">>> (37).bit_length()\n"
"6");
#define INT_BIT_LENGTH_METHODDEF …
static PyObject *
int_bit_length_impl(PyObject *self);
static PyObject *
int_bit_length(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
PyDoc_STRVAR(int_bit_count__doc__,
"bit_count($self, /)\n"
"--\n"
"\n"
"Number of ones in the binary representation of the absolute value of self.\n"
"\n"
"Also known as the population count.\n"
"\n"
">>> bin(13)\n"
"\'0b1101\'\n"
">>> (13).bit_count()\n"
"3");
#define INT_BIT_COUNT_METHODDEF …
static PyObject *
int_bit_count_impl(PyObject *self);
static PyObject *
int_bit_count(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
PyDoc_STRVAR(int_as_integer_ratio__doc__,
"as_integer_ratio($self, /)\n"
"--\n"
"\n"
"Return a pair of integers, whose ratio is equal to the original int.\n"
"\n"
"The ratio is in lowest terms and has a positive denominator.\n"
"\n"
">>> (10).as_integer_ratio()\n"
"(10, 1)\n"
">>> (-10).as_integer_ratio()\n"
"(-10, 1)\n"
">>> (0).as_integer_ratio()\n"
"(0, 1)");
#define INT_AS_INTEGER_RATIO_METHODDEF …
static PyObject *
int_as_integer_ratio_impl(PyObject *self);
static PyObject *
int_as_integer_ratio(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
PyDoc_STRVAR(int_to_bytes__doc__,
"to_bytes($self, /, length=1, byteorder=\'big\', *, signed=False)\n"
"--\n"
"\n"
"Return an array of bytes representing an integer.\n"
"\n"
" length\n"
" Length of bytes object to use. An OverflowError is raised if the\n"
" integer is not representable with the given number of bytes. Default\n"
" is length 1.\n"
" byteorder\n"
" The byte order used to represent the integer. If byteorder is \'big\',\n"
" the most significant byte is at the beginning of the byte array. If\n"
" byteorder is \'little\', the most significant byte is at the end of the\n"
" byte array. To request the native byte order of the host system, use\n"
" sys.byteorder as the byte order value. Default is to use \'big\'.\n"
" signed\n"
" Determines whether two\'s complement is used to represent the integer.\n"
" If signed is False and a negative integer is given, an OverflowError\n"
" is raised.");
#define INT_TO_BYTES_METHODDEF …
static PyObject *
int_to_bytes_impl(PyObject *self, Py_ssize_t length, PyObject *byteorder,
int is_signed);
static PyObject *
int_to_bytes(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{ … }
PyDoc_STRVAR(int_from_bytes__doc__,
"from_bytes($type, /, bytes, byteorder=\'big\', *, signed=False)\n"
"--\n"
"\n"
"Return the integer represented by the given array of bytes.\n"
"\n"
" bytes\n"
" Holds the array of bytes to convert. The argument must either\n"
" support the buffer protocol or be an iterable object producing bytes.\n"
" Bytes and bytearray are examples of built-in objects that support the\n"
" buffer protocol.\n"
" byteorder\n"
" The byte order used to represent the integer. If byteorder is \'big\',\n"
" the most significant byte is at the beginning of the byte array. If\n"
" byteorder is \'little\', the most significant byte is at the end of the\n"
" byte array. To request the native byte order of the host system, use\n"
" sys.byteorder as the byte order value. Default is to use \'big\'.\n"
" signed\n"
" Indicates whether two\'s complement is used to represent the integer.");
#define INT_FROM_BYTES_METHODDEF …
static PyObject *
int_from_bytes_impl(PyTypeObject *type, PyObject *bytes_obj,
PyObject *byteorder, int is_signed);
static PyObject *
int_from_bytes(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{ … }
PyDoc_STRVAR(int_is_integer__doc__,
"is_integer($self, /)\n"
"--\n"
"\n"
"Returns True. Exists for duck type compatibility with float.is_integer.");
#define INT_IS_INTEGER_METHODDEF …
static PyObject *
int_is_integer_impl(PyObject *self);
static PyObject *
int_is_integer(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }