Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e2a383d

Browse files
committed
Rip out 'long' and 'L'-suffixed integer literals.
(Rough first cut.)
1 parent fc7bb8c commit e2a383d

146 files changed

Lines changed: 1443 additions & 1474 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Lib/BaseHTTPServer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,12 @@ def send_error(self, code, message=None):
331331
"""
332332

333333
try:
334-
short, long = self.responses[code]
334+
shortmsg, longmsg = self.responses[code]
335335
except KeyError:
336-
short, long = '???', '???'
336+
shortmsg, longmsg = '???', '???'
337337
if message is None:
338-
message = short
339-
explain = long
338+
message = shortmsg
339+
explain = longmsg
340340
self.log_error("code %d, message %s", code, message)
341341
# using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201)
342342
content = (self.error_message_format %

Lib/UserString.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self, seq):
2020
def __str__(self): return str(self.data)
2121
def __repr__(self): return repr(self.data)
2222
def __int__(self): return int(self.data)
23-
def __long__(self): return long(self.data)
23+
def __long__(self): return int(self.data)
2424
def __float__(self): return float(self.data)
2525
def __complex__(self): return complex(self.data)
2626
def __hash__(self): return hash(self.data)

Lib/aifc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
class Error(Exception):
143143
pass
144144

145-
_AIFC_version = 0xA2805140L # Version 1 of AIFF-C
145+
_AIFC_version = 0xA2805140 # Version 1 of AIFF-C
146146

147147
_skiplist = 'COMT', 'INST', 'MIDI', 'AESD', \
148148
'APPL', 'NAME', 'AUTH', '(c) ', 'ANNO'
@@ -191,7 +191,7 @@ def _read_float(f): # 10 bytes
191191
f = _HUGE_VAL
192192
else:
193193
expon = expon - 16383
194-
f = (himant * 0x100000000L + lomant) * pow(2.0, expon - 63)
194+
f = (himant * 0x100000000 + lomant) * pow(2.0, expon - 63)
195195
return sign * f
196196

197197
def _write_short(f, x):
@@ -233,10 +233,10 @@ def _write_float(f, x):
233233
expon = expon | sign
234234
fmant = math.ldexp(fmant, 32)
235235
fsmant = math.floor(fmant)
236-
himant = long(fsmant)
236+
himant = int(fsmant)
237237
fmant = math.ldexp(fmant - fsmant, 32)
238238
fsmant = math.floor(fmant)
239-
lomant = long(fsmant)
239+
lomant = int(fsmant)
240240
_write_short(f, expon)
241241
_write_long(f, himant)
242242
_write_long(f, lomant)

Lib/asynchat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def handle_read (self):
105105
# no terminator, collect it all
106106
self.collect_incoming_data (self.ac_in_buffer)
107107
self.ac_in_buffer = ''
108-
elif isinstance(terminator, int) or isinstance(terminator, long):
108+
elif isinstance(terminator, int) or isinstance(terminator, int):
109109
# numeric terminator
110110
n = terminator
111111
if lb < n:

Lib/base64.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def urlsafe_b64decode(s):
129129
_b32tab = _b32alphabet.items()
130130
_b32tab.sort()
131131
_b32tab = [v for k, v in _b32tab]
132-
_b32rev = dict([(v, long(k)) for k, v in _b32alphabet.items()])
132+
_b32rev = dict([(v, int(k)) for k, v in _b32alphabet.items()])
133133

134134

135135
def b32encode(s):

Lib/copy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def copy(x):
9999

100100
def _copy_immutable(x):
101101
return x
102-
for t in (type(None), int, long, float, bool, str, tuple,
102+
for t in (type(None), int, int, float, bool, str, tuple,
103103
frozenset, type, xrange, types.ClassType,
104104
types.BuiltinFunctionType,
105105
types.FunctionType):
@@ -178,7 +178,7 @@ def _deepcopy_atomic(x, memo):
178178
return x
179179
d[type(None)] = _deepcopy_atomic
180180
d[int] = _deepcopy_atomic
181-
d[long] = _deepcopy_atomic
181+
d[int] = _deepcopy_atomic
182182
d[float] = _deepcopy_atomic
183183
d[bool] = _deepcopy_atomic
184184
try:
@@ -315,7 +315,7 @@ class _EmptyClass:
315315
pass
316316

317317
def _test():
318-
l = [None, 1, 2L, 3.14, 'xyzzy', (1, 2L), [3.14, 'abc'],
318+
l = [None, 1, 2, 3.14, 'xyzzy', (1, 2), [3.14, 'abc'],
319319
{'abc': 'ABC'}, (), [], {}]
320320
l1 = copy(l)
321321
print l1==l

Lib/csv.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def has_header(self, sample):
369369

370370
for col in columnTypes.keys():
371371

372-
for thisType in [int, long, float, complex]:
372+
for thisType in [int, int, float, complex]:
373373
try:
374374
thisType(row[col])
375375
break
@@ -380,7 +380,7 @@ def has_header(self, sample):
380380
thisType = len(row[col])
381381

382382
# treat longs as ints
383-
if thisType == long:
383+
if thisType == int:
384384
thisType = int
385385

386386
if thisType != columnTypes[col]:

Lib/ctypes/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def create_string_buffer(init, size=None):
6666
buf = buftype()
6767
buf.value = init
6868
return buf
69-
elif isinstance(init, (int, long)):
69+
elif isinstance(init, (int, int)):
7070
buftype = c_char * init
7171
buf = buftype()
7272
return buf
@@ -285,7 +285,7 @@ def create_unicode_buffer(init, size=None):
285285
buf = buftype()
286286
buf.value = init
287287
return buf
288-
elif isinstance(init, (int, long)):
288+
elif isinstance(init, (int, int)):
289289
buftype = c_wchar * init
290290
buf = buftype()
291291
return buf
@@ -356,7 +356,7 @@ def __getattr__(self, name):
356356

357357
def __getitem__(self, name_or_ordinal):
358358
func = self._FuncPtr((name_or_ordinal, self))
359-
if not isinstance(name_or_ordinal, (int, long)):
359+
if not isinstance(name_or_ordinal, (int, int)):
360360
func.__name__ = name_or_ordinal
361361
return func
362362

Lib/ctypes/test/test_as_parameter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def test_longlong_callbacks(self):
133133
f.argtypes = [c_longlong, MyCallback]
134134

135135
def callback(value):
136-
self.failUnless(isinstance(value, (int, long)))
136+
self.failUnless(isinstance(value, (int, int)))
137137
return value & 0x7FFFFFFF
138138

139139
cb = MyCallback(callback)

Lib/ctypes/test/test_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def test_longlong_callbacks(self):
291291
f.argtypes = [c_longlong, MyCallback]
292292

293293
def callback(value):
294-
self.failUnless(isinstance(value, (int, long)))
294+
self.failUnless(isinstance(value, (int, int)))
295295
return value & 0x7FFFFFFF
296296

297297
cb = MyCallback(callback)

0 commit comments

Comments
 (0)