summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-08-27 16:40:23 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-08-27 16:40:23 (GMT)
commit9594942716a8f9c557b85d31751753d89cd7cebf (patch)
tree847ee3a06cf8831731d4aa0adaee961accc74fda /Lib
parent4af4d273bd2c18e8e3d56dc43a877ce04a5a1e13 (diff)
downloadcpython-9594942716a8f9c557b85d31751753d89cd7cebf.zip
cpython-9594942716a8f9c557b85d31751753d89cd7cebf.tar.gz
cpython-9594942716a8f9c557b85d31751753d89cd7cebf.tar.bz2
Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ctypes/test/test_numbers.py2
-rw-r--r--Lib/datetime.py4
-rw-r--r--Lib/pickle.py4
-rw-r--r--Lib/pickletools.py8
-rw-r--r--Lib/random.py2
-rw-r--r--Lib/test/test_cmath.py2
-rw-r--r--Lib/test/test_compile.py2
-rw-r--r--Lib/test/test_decimal.py2
-rw-r--r--Lib/test/test_gdb.py2
-rw-r--r--Lib/test/test_itertools.py14
-rw-r--r--Lib/test/test_long.py15
-rw-r--r--Lib/test/test_struct.py2
-rw-r--r--Lib/test/test_sys.py2
-rw-r--r--Lib/xmlrpc/client.py2
14 files changed, 26 insertions, 37 deletions
diff --git a/Lib/ctypes/test/test_numbers.py b/Lib/ctypes/test/test_numbers.py
index e697a25..c02abf9 100644
--- a/Lib/ctypes/test/test_numbers.py
+++ b/Lib/ctypes/test/test_numbers.py
@@ -104,7 +104,7 @@ class NumberTestCase(unittest.TestCase):
def test_floats(self):
# c_float and c_double can be created from
- # Python int, long and float
+ # Python int and float
class FloatLike(object):
def __float__(self):
return 2.0
diff --git a/Lib/datetime.py b/Lib/datetime.py
index 4bba70b..d1f353b 100644
--- a/Lib/datetime.py
+++ b/Lib/datetime.py
@@ -287,7 +287,7 @@ class timedelta:
- add, subtract timedelta
- unary plus, minus, abs
- compare to timedelta
- - multiply, divide by int/long
+ - multiply, divide by int
In addition, datetime supports subtraction of two datetime objects
returning a timedelta, and addition or subtraction of a datetime
@@ -1290,7 +1290,7 @@ class datetime(date):
"""datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
The year, month and day arguments are required. tzinfo may be None, or an
- instance of a tzinfo subclass. The remaining arguments may be ints or longs.
+ instance of a tzinfo subclass. The remaining arguments may be ints.
"""
__slots__ = date.__slots__ + (
diff --git a/Lib/pickle.py b/Lib/pickle.py
index 1d8185c..d62f014 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -1270,7 +1270,7 @@ class _Unpickler:
raise _Stop(value)
dispatch[STOP[0]] = load_stop
-# Encode/decode longs.
+# Encode/decode ints.
def encode_long(x):
r"""Encode a long to a two's complement little-endian binary string.
@@ -1303,7 +1303,7 @@ def encode_long(x):
return result
def decode_long(data):
- r"""Decode a long from a two's complement little-endian binary string.
+ r"""Decode an int from a two's complement little-endian binary string.
>>> decode_long(b'')
0
diff --git a/Lib/pickletools.py b/Lib/pickletools.py
index 7351c8d..612fa8f 100644
--- a/Lib/pickletools.py
+++ b/Lib/pickletools.py
@@ -580,16 +580,12 @@ def read_decimalnl_short(f):
>>> read_decimalnl_short(io.BytesIO(b"1234L\n56"))
Traceback (most recent call last):
...
- ValueError: trailing 'L' not allowed in b'1234L'
+ ValueError: invalid literal for int() with base 10: b'1234L'
"""
s = read_stringnl(f, decode=False, stripquotes=False)
- if s.endswith(b"L"):
- raise ValueError("trailing 'L' not allowed in %r" % s)
- # It's not necessarily true that the result fits in a Python short int:
- # the pickle may have been written on a 64-bit box. There's also a hack
- # for True and False here.
+ # There's a hack for True and False here.
if s == b"00":
return False
elif s == b"01":
diff --git a/Lib/random.py b/Lib/random.py
index 7d8d4f3..cf83114 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -633,7 +633,7 @@ class SystemRandom(Random):
return (int.from_bytes(_urandom(7), 'big') >> 3) * RECIP_BPF
def getrandbits(self, k):
- """getrandbits(k) -> x. Generates a long int with k random bits."""
+ """getrandbits(k) -> x. Generates an int with k random bits."""
if k <= 0:
raise ValueError('number of bits must be greater than zero')
if k != int(k):
diff --git a/Lib/test/test_cmath.py b/Lib/test/test_cmath.py
index 692ea36..4db6b2b 100644
--- a/Lib/test/test_cmath.py
+++ b/Lib/test/test_cmath.py
@@ -253,7 +253,7 @@ class CMathTests(unittest.TestCase):
self.assertRaises(SomeException, f, MyComplexExceptionOS())
def test_input_type(self):
- # ints and longs should be acceptable inputs to all cmath
+ # ints should be acceptable inputs to all cmath
# functions, by virtue of providing a __float__ method
for f in self.test_functions:
for arg in [2, 2.]:
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index 1071f4a..ccd08db 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -198,7 +198,7 @@ if 1:
else:
self.fail("How many bits *does* this machine have???")
# Verify treatment of constant folding on -(sys.maxsize+1)
- # i.e. -2147483648 on 32 bit platforms. Should return int, not long.
+ # i.e. -2147483648 on 32 bit platforms. Should return int.
self.assertIsInstance(eval("%s" % (-sys.maxsize - 1)), int)
self.assertIsInstance(eval("%s" % (-sys.maxsize - 2)), int)
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
index 50a9ad4..71b93a6 100644
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -1838,7 +1838,7 @@ class UsabilityTest(unittest.TestCase):
self.assertIs(max(d1,d2), d2)
self.assertIs(max(d2,d1), d2)
- #between Decimal and long
+ #between Decimal and int
self.assertIs(min(d1,l2), d1)
self.assertIs(min(l2,d1), d1)
self.assertIs(max(l1,d2), d2)
diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py
index abcb23e..6c3f467 100644
--- a/Lib/test/test_gdb.py
+++ b/Lib/test/test_gdb.py
@@ -227,7 +227,7 @@ class PrettyPrintTests(DebuggerTests):
% (gdb_repr, exp_repr, gdb_output)))
def test_int(self):
- 'Verify the pretty-printing of various "int"/long values'
+ 'Verify the pretty-printing of various int values'
self.assertGdbRepr(42)
self.assertGdbRepr(0)
self.assertGdbRepr(-7)
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index 53926a9..514a6b7 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -505,9 +505,9 @@ class TestBasicOps(unittest.TestCase):
self.assertEqual(repr(count(10.25)), 'count(10.25)')
self.assertEqual(next(c), -8)
for i in (-sys.maxsize-5, -sys.maxsize+5 ,-10, -1, 0, 10, sys.maxsize-5, sys.maxsize+5):
- # Test repr (ignoring the L in longs)
- r1 = repr(count(i)).replace('L', '')
- r2 = 'count(%r)'.__mod__(i).replace('L', '')
+ # Test repr
+ r1 = repr(count(i))
+ r2 = 'count(%r)'.__mod__(i)
self.assertEqual(r1, r2)
# check copy, deepcopy, pickle
@@ -555,12 +555,12 @@ class TestBasicOps(unittest.TestCase):
self.assertEqual(repr(count(10.5, 1.00)), 'count(10.5, 1.0)') # do show float values lilke 1.0
for i in (-sys.maxsize-5, -sys.maxsize+5 ,-10, -1, 0, 10, sys.maxsize-5, sys.maxsize+5):
for j in (-sys.maxsize-5, -sys.maxsize+5 ,-10, -1, 0, 1, 10, sys.maxsize-5, sys.maxsize+5):
- # Test repr (ignoring the L in longs)
- r1 = repr(count(i, j)).replace('L', '')
+ # Test repr
+ r1 = repr(count(i, j))
if j == 1:
- r2 = ('count(%r)' % i).replace('L', '')
+ r2 = ('count(%r)' % i)
else:
- r2 = ('count(%r, %r)' % (i, j)).replace('L', '')
+ r2 = ('count(%r, %r)' % (i, j))
self.assertEqual(r1, r2)
self.pickletest(count(i, j))
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py
index b417bea..baf1d6a 100644
--- a/Lib/test/test_long.py
+++ b/Lib/test/test_long.py
@@ -322,20 +322,13 @@ class LongTest(unittest.TestCase):
"".join("0123456789abcdef"[i] for i in digits)
def check_format_1(self, x):
- for base, mapper in (8, oct), (10, repr), (16, hex):
+ for base, mapper in (2, bin), (8, oct), (10, str), (10, repr), (16, hex):
got = mapper(x)
expected = self.slow_format(x, base)
msg = Frm("%s returned %r but expected %r for %r",
mapper.__name__, got, expected, x)
self.assertEqual(got, expected, msg)
self.assertEqual(int(got, 0), x, Frm('int("%s", 0) != %r', got, x))
- # str() has to be checked a little differently since there's no
- # trailing "L"
- got = str(x)
- expected = self.slow_format(x, 10)
- msg = Frm("%s returned %r but expected %r for %r",
- mapper.__name__, got, expected, x)
- self.assertEqual(got, expected, msg)
def test_format(self):
for x in special:
@@ -553,11 +546,11 @@ class LongTest(unittest.TestCase):
def test_mixed_compares(self):
eq = self.assertEqual
- # We're mostly concerned with that mixing floats and longs does the
- # right stuff, even when longs are too large to fit in a float.
+ # We're mostly concerned with that mixing floats and ints does the
+ # right stuff, even when ints are too large to fit in a float.
# The safest way to check the results is to use an entirely different
# method, which we do here via a skeletal rational class (which
- # represents all Python ints, longs and floats exactly).
+ # represents all Python ints and floats exactly).
class Rat:
def __init__(self, value):
if isinstance(value, int):
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py
index 22374d2..50cae05 100644
--- a/Lib/test/test_struct.py
+++ b/Lib/test/test_struct.py
@@ -278,7 +278,7 @@ class StructTest(unittest.TestCase):
# Objects with an '__index__' method should be allowed
# to pack as integers. That is assuming the implemented
- # '__index__' method returns and 'int' or 'long'.
+ # '__index__' method returns an 'int'.
class Indexable(object):
def __init__(self, value):
self._value = value
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 9d97c8d..bc4c0ad 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -767,7 +767,7 @@ class SizeofTest(unittest.TestCase):
check(iter([]), size('lP'))
# listreverseiterator (list)
check(reversed([]), size('nP'))
- # long
+ # int
check(0, vsize(''))
check(1, vsize('') + self.longdigit)
check(-1, vsize('') + self.longdigit)
diff --git a/Lib/xmlrpc/client.py b/Lib/xmlrpc/client.py
index d7b2db3..0f9522a 100644
--- a/Lib/xmlrpc/client.py
+++ b/Lib/xmlrpc/client.py
@@ -539,7 +539,7 @@ class Marshaller:
def dump_long(self, value, write):
if value > MAXINT or value < MININT:
- raise OverflowError("long int exceeds XML-RPC limits")
+ raise OverflowError("int exceeds XML-RPC limits")
write("<value><int>")
write(str(int(value)))
write("</int></value>\n")