mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
This commit is contained in:
parent
4af4d273bd
commit
9594942716
40 changed files with 137 additions and 150 deletions
|
|
@ -1132,8 +1132,8 @@ PyNumber_Absolute(PyObject *o)
|
|||
return type_error("bad operand type for abs(): '%.200s'", o);
|
||||
}
|
||||
|
||||
/* Return a Python Int or Long from the object item
|
||||
Raise TypeError if the result is not an int-or-long
|
||||
/* Return a Python int from the object item
|
||||
Raise TypeError if the result is not an int
|
||||
or if the object cannot be interpreted as an index.
|
||||
*/
|
||||
PyObject *
|
||||
|
|
@ -1343,8 +1343,7 @@ PyNumber_ToBase(PyObject *n, int base)
|
|||
/* It should not be possible to get here, as
|
||||
PyNumber_Index already has a check for the same
|
||||
condition */
|
||||
PyErr_SetString(PyExc_ValueError, "PyNumber_ToBase: index not "
|
||||
"int or long");
|
||||
PyErr_SetString(PyExc_ValueError, "PyNumber_ToBase: index not int");
|
||||
Py_DECREF(index);
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,9 +186,9 @@ PyFile_WriteString(const char *s, PyObject *f)
|
|||
}
|
||||
|
||||
/* Try to get a file-descriptor from a Python object. If the object
|
||||
is an integer or long integer, its value is returned. If not, the
|
||||
is an integer, its value is returned. If not, the
|
||||
object's fileno() method is called if it exists; the method must return
|
||||
an integer or long integer, which is returned as the file descriptor value.
|
||||
an integer, which is returned as the file descriptor value.
|
||||
-1 is returned on failure.
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ PyFloat_AsDouble(PyObject *op)
|
|||
/* Macro and helper that convert PyObject obj to a C double and store
|
||||
the value in dbl. If conversion to double raises an exception, obj is
|
||||
set to NULL, and the function invoking this macro returns NULL. If
|
||||
obj is not of float, int or long type, Py_NotImplemented is incref'ed,
|
||||
obj is not of float or int type, Py_NotImplemented is incref'ed,
|
||||
stored in obj, and returned from the function invoking this macro.
|
||||
*/
|
||||
#define CONVERT_TO_DOUBLE(obj, dbl) \
|
||||
|
|
@ -287,7 +287,7 @@ float_repr(PyFloatObject *v)
|
|||
* When mixing float with an integer type, there's no good *uniform* approach.
|
||||
* Converting the double to an integer obviously doesn't work, since we
|
||||
* may lose info from fractional bits. Converting the integer to a double
|
||||
* also has two failure modes: (1) a long int may trigger overflow (too
|
||||
* also has two failure modes: (1) an int may trigger overflow (too
|
||||
* large to fit in the dynamic range of a C double); (2) even a C long may have
|
||||
* more bits than fit in a C double (e.g., on a 64-bit box long may have
|
||||
* 63 bits of precision, but a C double probably has only 53), and then
|
||||
|
|
@ -385,7 +385,7 @@ float_richcompare(PyObject *v, PyObject *w, int op)
|
|||
goto Compare;
|
||||
}
|
||||
/* v and w have the same number of bits before the radix
|
||||
* point. Construct two longs that have the same comparison
|
||||
* point. Construct two ints that have the same comparison
|
||||
* outcome.
|
||||
*/
|
||||
{
|
||||
|
|
@ -450,7 +450,7 @@ float_richcompare(PyObject *v, PyObject *w, int op)
|
|||
}
|
||||
} /* else if (PyLong_Check(w)) */
|
||||
|
||||
else /* w isn't float, int, or long */
|
||||
else /* w isn't float or int */
|
||||
goto Unimplemented;
|
||||
|
||||
Compare:
|
||||
|
|
|
|||
|
|
@ -68,16 +68,16 @@ maybe_small_long(PyLongObject *v)
|
|||
#define maybe_small_long(val) (val)
|
||||
#endif
|
||||
|
||||
/* If a freshly-allocated long is already shared, it must
|
||||
/* If a freshly-allocated int is already shared, it must
|
||||
be a small integer, so negating it must go to PyLong_FromLong */
|
||||
#define NEGATE(x) \
|
||||
do if (Py_REFCNT(x) == 1) Py_SIZE(x) = -Py_SIZE(x); \
|
||||
else { PyObject* tmp=PyLong_FromLong(-MEDIUM_VALUE(x)); \
|
||||
Py_DECREF(x); (x) = (PyLongObject*)tmp; } \
|
||||
while(0)
|
||||
/* For long multiplication, use the O(N**2) school algorithm unless
|
||||
/* For int multiplication, use the O(N**2) school algorithm unless
|
||||
* both operands contain more than KARATSUBA_CUTOFF digits (this
|
||||
* being an internal Python long digit, in base BASE).
|
||||
* being an internal Python int digit, in base BASE).
|
||||
*/
|
||||
#define KARATSUBA_CUTOFF 70
|
||||
#define KARATSUBA_SQUARE_CUTOFF (2 * KARATSUBA_CUTOFF)
|
||||
|
|
@ -99,7 +99,7 @@ maybe_small_long(PyLongObject *v)
|
|||
if (PyErr_CheckSignals()) PyTryBlock \
|
||||
} while(0)
|
||||
|
||||
/* Normalize (remove leading zeros from) a long int object.
|
||||
/* Normalize (remove leading zeros from) an int object.
|
||||
Doesn't attempt to free the storage--in most cases, due to the nature
|
||||
of the algorithms used, this could save at most be one word anyway. */
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ long_normalize(register PyLongObject *v)
|
|||
return v;
|
||||
}
|
||||
|
||||
/* Allocate a new long int object with size digits.
|
||||
/* Allocate a new int object with size digits.
|
||||
Return NULL and set exception if we run out of memory. */
|
||||
|
||||
#define MAX_LONG_DIGITS \
|
||||
|
|
@ -168,7 +168,7 @@ _PyLong_Copy(PyLongObject *src)
|
|||
return (PyObject *)result;
|
||||
}
|
||||
|
||||
/* Create a new long int object from a C long int */
|
||||
/* Create a new int object from a C long int */
|
||||
|
||||
PyObject *
|
||||
PyLong_FromLong(long ival)
|
||||
|
|
@ -237,7 +237,7 @@ PyLong_FromLong(long ival)
|
|||
return (PyObject *)v;
|
||||
}
|
||||
|
||||
/* Create a new long int object from a C unsigned long int */
|
||||
/* Create a new int object from a C unsigned long int */
|
||||
|
||||
PyObject *
|
||||
PyLong_FromUnsignedLong(unsigned long ival)
|
||||
|
|
@ -266,7 +266,7 @@ PyLong_FromUnsignedLong(unsigned long ival)
|
|||
return (PyObject *)v;
|
||||
}
|
||||
|
||||
/* Create a new long int object from a C double */
|
||||
/* Create a new int object from a C double */
|
||||
|
||||
PyObject *
|
||||
PyLong_FromDouble(double dval)
|
||||
|
|
@ -320,7 +320,7 @@ PyLong_FromDouble(double dval)
|
|||
#define PY_ABS_LONG_MIN (0-(unsigned long)LONG_MIN)
|
||||
#define PY_ABS_SSIZE_T_MIN (0-(size_t)PY_SSIZE_T_MIN)
|
||||
|
||||
/* Get a C long int from a long int object or any object that has an __int__
|
||||
/* Get a C long int from an int object or any object that has an __int__
|
||||
method.
|
||||
|
||||
On overflow, return -1 and set *overflow to 1 or -1 depending on the sign of
|
||||
|
|
@ -417,7 +417,7 @@ PyLong_AsLongAndOverflow(PyObject *vv, int *overflow)
|
|||
return res;
|
||||
}
|
||||
|
||||
/* Get a C long int from a long int object or any object that has an __int__
|
||||
/* Get a C long int from an int object or any object that has an __int__
|
||||
method. Return -1 and set an error if overflow occurs. */
|
||||
|
||||
long
|
||||
|
|
@ -434,7 +434,7 @@ PyLong_AsLong(PyObject *obj)
|
|||
return result;
|
||||
}
|
||||
|
||||
/* Get a C int from a long int object or any object that has an __int__
|
||||
/* Get a C int from an int object or any object that has an __int__
|
||||
method. Return -1 and set an error if overflow occurs. */
|
||||
|
||||
int
|
||||
|
|
@ -452,7 +452,7 @@ _PyLong_AsInt(PyObject *obj)
|
|||
return (int)result;
|
||||
}
|
||||
|
||||
/* Get a Py_ssize_t from a long int object.
|
||||
/* Get a Py_ssize_t from an int object.
|
||||
Returns -1 and sets an error condition if overflow occurs. */
|
||||
|
||||
Py_ssize_t
|
||||
|
|
@ -507,7 +507,7 @@ PyLong_AsSsize_t(PyObject *vv) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Get a C unsigned long int from a long int object.
|
||||
/* Get a C unsigned long int from an int object.
|
||||
Returns -1 and sets an error condition if overflow occurs. */
|
||||
|
||||
unsigned long
|
||||
|
|
@ -551,7 +551,7 @@ PyLong_AsUnsignedLong(PyObject *vv)
|
|||
return x;
|
||||
}
|
||||
|
||||
/* Get a C size_t from a long int object. Returns (size_t)-1 and sets
|
||||
/* Get a C size_t from an int object. Returns (size_t)-1 and sets
|
||||
an error condition if overflow occurs. */
|
||||
|
||||
size_t
|
||||
|
|
@ -594,7 +594,7 @@ PyLong_AsSize_t(PyObject *vv)
|
|||
return x;
|
||||
}
|
||||
|
||||
/* Get a C unsigned long int from a long int object, ignoring the high bits.
|
||||
/* Get a C unsigned long int from an int object, ignoring the high bits.
|
||||
Returns -1 and sets an error condition if an error occurs. */
|
||||
|
||||
static unsigned long
|
||||
|
|
@ -712,7 +712,7 @@ _PyLong_FromByteArray(const unsigned char* bytes, size_t n,
|
|||
int incr; /* direction to move pstartbyte */
|
||||
const unsigned char* pendbyte; /* MSB of bytes */
|
||||
size_t numsignificantbytes; /* number of bytes that matter */
|
||||
Py_ssize_t ndigits; /* number of Python long digits */
|
||||
Py_ssize_t ndigits; /* number of Python int digits */
|
||||
PyLongObject* v; /* result */
|
||||
Py_ssize_t idigit = 0; /* next free index in v->ob_digit */
|
||||
|
||||
|
|
@ -756,8 +756,8 @@ _PyLong_FromByteArray(const unsigned char* bytes, size_t n,
|
|||
++numsignificantbytes;
|
||||
}
|
||||
|
||||
/* How many Python long digits do we need? We have
|
||||
8*numsignificantbytes bits, and each Python long digit has
|
||||
/* How many Python int digits do we need? We have
|
||||
8*numsignificantbytes bits, and each Python int digit has
|
||||
PyLong_SHIFT bits, so it's the ceiling of the quotient. */
|
||||
/* catch overflow before it happens */
|
||||
if (numsignificantbytes > (PY_SSIZE_T_MAX - PyLong_SHIFT) / 8) {
|
||||
|
|
@ -857,7 +857,7 @@ _PyLong_AsByteArray(PyLongObject* v,
|
|||
|
||||
/* Copy over all the Python digits.
|
||||
It's crucial that every Python digit except for the MSD contribute
|
||||
exactly PyLong_SHIFT bits to the total, so first assert that the long is
|
||||
exactly PyLong_SHIFT bits to the total, so first assert that the int is
|
||||
normalized. */
|
||||
assert(ndigits == 0 || v->ob_digit[ndigits - 1] != 0);
|
||||
j = 0;
|
||||
|
|
@ -912,7 +912,7 @@ _PyLong_AsByteArray(PyLongObject* v,
|
|||
++j;
|
||||
if (do_twos_comp) {
|
||||
/* Fill leading bits of the byte with sign bits
|
||||
(appropriately pretending that the long had an
|
||||
(appropriately pretending that the int had an
|
||||
infinite supply of sign bits). */
|
||||
accum |= (~(twodigits)0) << accumbits;
|
||||
}
|
||||
|
|
@ -948,7 +948,7 @@ _PyLong_AsByteArray(PyLongObject* v,
|
|||
|
||||
}
|
||||
|
||||
/* Create a new long int object from a C pointer */
|
||||
/* Create a new int object from a C pointer */
|
||||
|
||||
PyObject *
|
||||
PyLong_FromVoidPtr(void *p)
|
||||
|
|
@ -974,7 +974,7 @@ PyLong_FromVoidPtr(void *p)
|
|||
|
||||
}
|
||||
|
||||
/* Get a C pointer from a long int object. */
|
||||
/* Get a C pointer from an int object. */
|
||||
|
||||
void *
|
||||
PyLong_AsVoidPtr(PyObject *vv)
|
||||
|
|
@ -1017,7 +1017,7 @@ PyLong_AsVoidPtr(PyObject *vv)
|
|||
#define IS_LITTLE_ENDIAN (int)*(unsigned char*)&one
|
||||
#define PY_ABS_LLONG_MIN (0-(unsigned PY_LONG_LONG)PY_LLONG_MIN)
|
||||
|
||||
/* Create a new long int object from a C PY_LONG_LONG int. */
|
||||
/* Create a new int object from a C PY_LONG_LONG int. */
|
||||
|
||||
PyObject *
|
||||
PyLong_FromLongLong(PY_LONG_LONG ival)
|
||||
|
|
@ -1061,7 +1061,7 @@ PyLong_FromLongLong(PY_LONG_LONG ival)
|
|||
return (PyObject *)v;
|
||||
}
|
||||
|
||||
/* Create a new long int object from a C unsigned PY_LONG_LONG int. */
|
||||
/* Create a new int object from a C unsigned PY_LONG_LONG int. */
|
||||
|
||||
PyObject *
|
||||
PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG ival)
|
||||
|
|
@ -1090,7 +1090,7 @@ PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG ival)
|
|||
return (PyObject *)v;
|
||||
}
|
||||
|
||||
/* Create a new long int object from a C Py_ssize_t. */
|
||||
/* Create a new int object from a C Py_ssize_t. */
|
||||
|
||||
PyObject *
|
||||
PyLong_FromSsize_t(Py_ssize_t ival)
|
||||
|
|
@ -1130,7 +1130,7 @@ PyLong_FromSsize_t(Py_ssize_t ival)
|
|||
return (PyObject *)v;
|
||||
}
|
||||
|
||||
/* Create a new long int object from a C size_t. */
|
||||
/* Create a new int object from a C size_t. */
|
||||
|
||||
PyObject *
|
||||
PyLong_FromSize_t(size_t ival)
|
||||
|
|
@ -1159,7 +1159,7 @@ PyLong_FromSize_t(size_t ival)
|
|||
return (PyObject *)v;
|
||||
}
|
||||
|
||||
/* Get a C long long int from a long int object or any object that has an
|
||||
/* Get a C long long int from an int object or any object that has an
|
||||
__int__ method. Return -1 and set an error if overflow occurs. */
|
||||
|
||||
PY_LONG_LONG
|
||||
|
|
@ -1211,7 +1211,7 @@ PyLong_AsLongLong(PyObject *vv)
|
|||
return bytes;
|
||||
}
|
||||
|
||||
/* Get a C unsigned PY_LONG_LONG int from a long int object.
|
||||
/* Get a C unsigned PY_LONG_LONG int from an int object.
|
||||
Return -1 and set an error if overflow occurs. */
|
||||
|
||||
unsigned PY_LONG_LONG
|
||||
|
|
@ -1247,7 +1247,7 @@ PyLong_AsUnsignedLongLong(PyObject *vv)
|
|||
return bytes;
|
||||
}
|
||||
|
||||
/* Get a C unsigned long int from a long int object, ignoring the high bits.
|
||||
/* Get a C unsigned long int from an int object, ignoring the high bits.
|
||||
Returns -1 and sets an error condition if an error occurs. */
|
||||
|
||||
static unsigned PY_LONG_LONG
|
||||
|
|
@ -1316,7 +1316,7 @@ PyLong_AsUnsignedLongLongMask(register PyObject *op)
|
|||
}
|
||||
#undef IS_LITTLE_ENDIAN
|
||||
|
||||
/* Get a C long long int from a long int object or any object that has an
|
||||
/* Get a C long long int from an int object or any object that has an
|
||||
__int__ method.
|
||||
|
||||
On overflow, return -1 and set *overflow to 1 or -1 depending on the sign of
|
||||
|
|
@ -1533,7 +1533,7 @@ v_rshift(digit *z, digit *a, Py_ssize_t m, int d)
|
|||
/* Divide long pin, w/ size digits, by non-zero digit n, storing quotient
|
||||
in pout, and returning the remainder. pin and pout point at the LSD.
|
||||
It's OK for pin == pout on entry, which saves oodles of mallocs/frees in
|
||||
_PyLong_Format, but that should be done with great care since longs are
|
||||
_PyLong_Format, but that should be done with great care since ints are
|
||||
immutable. */
|
||||
|
||||
static digit
|
||||
|
|
@ -1553,7 +1553,7 @@ inplace_divrem1(digit *pout, digit *pin, Py_ssize_t size, digit n)
|
|||
return (digit)rem;
|
||||
}
|
||||
|
||||
/* Divide a long integer by a digit, returning both the quotient
|
||||
/* Divide an integer by a digit, returning both the quotient
|
||||
(as function result) and the remainder (through *prem).
|
||||
The sign of a is ignored; n should not be zero. */
|
||||
|
||||
|
|
@ -1571,7 +1571,7 @@ divrem1(PyLongObject *a, digit n, digit *prem)
|
|||
return long_normalize(z);
|
||||
}
|
||||
|
||||
/* Convert a long integer to a base 10 string. Returns a new non-shared
|
||||
/* Convert an integer to a base 10 string. Returns a new non-shared
|
||||
string. (Return value is non-shared so that callers can modify the
|
||||
returned value if necessary.) */
|
||||
|
||||
|
|
@ -1740,7 +1740,7 @@ long_to_decimal_string(PyObject *aa)
|
|||
return v;
|
||||
}
|
||||
|
||||
/* Convert a long int object to a string, using a given conversion base,
|
||||
/* Convert an int object to a string, using a given conversion base,
|
||||
which should be one of 2, 8 or 16. Return a string object.
|
||||
If base is 2, 8 or 16, add the proper prefix '0b', '0o' or '0x'
|
||||
if alternate is nonzero. */
|
||||
|
|
@ -1941,7 +1941,7 @@ unsigned char _PyLong_DigitValue[256] = {
|
|||
|
||||
/* *str points to the first digit in a string of base `base` digits. base
|
||||
* is a power of 2 (2, 4, 8, 16, or 32). *str is set to point to the first
|
||||
* non-digit (which may be *str!). A normalized long is returned.
|
||||
* non-digit (which may be *str!). A normalized int is returned.
|
||||
* The point to this routine is that it takes time linear in the number of
|
||||
* string characters.
|
||||
*/
|
||||
|
|
@ -1976,7 +1976,7 @@ long_from_binary_base(char **str, int base)
|
|||
z = _PyLong_New(n);
|
||||
if (z == NULL)
|
||||
return NULL;
|
||||
/* Read string from right, and fill in long from left; i.e.,
|
||||
/* Read string from right, and fill in int from left; i.e.,
|
||||
* from least to most significant in both.
|
||||
*/
|
||||
accum = 0;
|
||||
|
|
@ -2005,7 +2005,7 @@ long_from_binary_base(char **str, int base)
|
|||
return long_normalize(z);
|
||||
}
|
||||
|
||||
/* Parses a long from a bytestring. Leading and trailing whitespace will be
|
||||
/* Parses an int from a bytestring. Leading and trailing whitespace will be
|
||||
* ignored.
|
||||
*
|
||||
* If successful, a PyLong object will be returned and 'pend' will be pointing
|
||||
|
|
@ -2075,7 +2075,7 @@ case number of Python digits needed to hold it is the smallest integer n s.t.
|
|||
n >= log(B**N)/log(BASE) = N * log(B)/log(BASE)
|
||||
|
||||
The static array log_base_BASE[base] == log(base)/log(BASE) so we can compute
|
||||
this quickly. A Python long with that much space is reserved near the start,
|
||||
this quickly. A Python int with that much space is reserved near the start,
|
||||
and the result is computed into it.
|
||||
|
||||
The input string is actually treated as being in base base**i (i.e., i digits
|
||||
|
|
@ -2140,7 +2140,7 @@ is very close to an integer. If we were working with IEEE single-precision,
|
|||
rounding errors could kill us. Finding worst cases in IEEE double-precision
|
||||
requires better-than-double-precision log() functions, and Tim didn't bother.
|
||||
Instead the code checks to see whether the allocated space is enough as each
|
||||
new Python digit is added, and copies the whole thing to a larger long if not.
|
||||
new Python digit is added, and copies the whole thing to a larger int if not.
|
||||
This should happen extremely rarely, and in fact I don't have a test case
|
||||
that triggers it(!). Instead the code was tested by artificially allocating
|
||||
just 1 digit at the start, so that the copying code was exercised for every
|
||||
|
|
@ -2181,7 +2181,7 @@ digit beyond the first.
|
|||
while (_PyLong_DigitValue[Py_CHARMASK(*scan)] < base)
|
||||
++scan;
|
||||
|
||||
/* Create a long object that can contain the largest possible
|
||||
/* Create an int object that can contain the largest possible
|
||||
* integer with this base and length. Note that there's no
|
||||
* need to initialize z->ob_digit -- no slot is read up before
|
||||
* being stored into.
|
||||
|
|
@ -2374,7 +2374,7 @@ static PyLongObject *x_divrem
|
|||
(PyLongObject *, PyLongObject *, PyLongObject **);
|
||||
static PyObject *long_long(PyObject *v);
|
||||
|
||||
/* Long division with remainder, top-level routine */
|
||||
/* Int division with remainder, top-level routine */
|
||||
|
||||
static int
|
||||
long_divrem(PyLongObject *a, PyLongObject *b,
|
||||
|
|
@ -2427,7 +2427,7 @@ long_divrem(PyLongObject *a, PyLongObject *b,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Unsigned long division with remainder -- the algorithm. The arguments v1
|
||||
/* Unsigned int division with remainder -- the algorithm. The arguments v1
|
||||
and w1 should satisfy 2 <= ABS(Py_SIZE(w1)) <= ABS(Py_SIZE(v1)). */
|
||||
|
||||
static PyLongObject *
|
||||
|
|
@ -2678,7 +2678,7 @@ _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e)
|
|||
return -1.0;
|
||||
}
|
||||
|
||||
/* Get a C double from a long int object. Rounds to the nearest double,
|
||||
/* Get a C double from an int object. Rounds to the nearest double,
|
||||
using the round-half-to-even rule in the case of a tie. */
|
||||
|
||||
double
|
||||
|
|
@ -2834,7 +2834,7 @@ long_hash(PyLongObject *v)
|
|||
}
|
||||
|
||||
|
||||
/* Add the absolute values of two long integers. */
|
||||
/* Add the absolute values of two integers. */
|
||||
|
||||
static PyLongObject *
|
||||
x_add(PyLongObject *a, PyLongObject *b)
|
||||
|
|
@ -3042,7 +3042,7 @@ x_mul(PyLongObject *a, PyLongObject *b)
|
|||
assert((carry >> PyLong_SHIFT) == 0);
|
||||
}
|
||||
}
|
||||
else { /* a is not the same as b -- gradeschool long mult */
|
||||
else { /* a is not the same as b -- gradeschool int mult */
|
||||
for (i = 0; i < size_a; ++i) {
|
||||
twodigits carry = 0;
|
||||
twodigits f = a->ob_digit[i];
|
||||
|
|
@ -3070,7 +3070,7 @@ x_mul(PyLongObject *a, PyLongObject *b)
|
|||
}
|
||||
|
||||
/* A helper for Karatsuba multiplication (k_mul).
|
||||
Takes a long "n" and an integer "size" representing the place to
|
||||
Takes an int "n" and an integer "size" representing the place to
|
||||
split, and sets low and high such that abs(n) == (high << size) + low,
|
||||
viewing the shift as being by digits. The sign bit is ignored, and
|
||||
the return values are >= 0.
|
||||
|
|
@ -4368,10 +4368,10 @@ long_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
}
|
||||
}
|
||||
|
||||
/* Wimpy, slow approach to tp_new calls for subtypes of long:
|
||||
first create a regular long from whatever arguments we got,
|
||||
/* Wimpy, slow approach to tp_new calls for subtypes of int:
|
||||
first create a regular int from whatever arguments we got,
|
||||
then allocate a subtype instance and initialize it from
|
||||
the regular long. The regular long is then thrown away.
|
||||
the regular int. The regular int is then thrown away.
|
||||
*/
|
||||
static PyObject *
|
||||
long_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
|
|
@ -4822,7 +4822,7 @@ long_from_bytes(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
Py_DECREF(bytes);
|
||||
|
||||
/* If from_bytes() was used on subclass, allocate new subclass
|
||||
* instance, initialize it with decoded long value and return it.
|
||||
* instance, initialize it with decoded int value and return it.
|
||||
*/
|
||||
if (type != &PyLong_Type && PyType_IsSubtype(type, &PyLong_Type)) {
|
||||
PyLongObject *newobj;
|
||||
|
|
|
|||
|
|
@ -933,7 +933,7 @@ PyTypeObject PyRange_Type = {
|
|||
/*********************** range Iterator **************************/
|
||||
|
||||
/* There are 2 types of iterators, one for C longs, the other for
|
||||
Python longs (ie, PyObjects). This should make iteration fast
|
||||
Python ints (ie, PyObjects). This should make iteration fast
|
||||
in the normal case, but possible for any numeric value.
|
||||
*/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue