Convert `long` to `int`, and portably detect all integral types.

llvm-svn: 251305
This commit is contained in:
Zachary Turner 2015-10-26 16:51:09 +00:00
parent 36b225913c
commit f67f7e31e7
5 changed files with 13 additions and 9 deletions

View File

@ -32,7 +32,7 @@ class CommonShortSpellingsTestCase(TestBase):
('ta st li', 'target stop-hook list'),
]
for (short, long) in abbrevs:
command_interpreter.ResolveCommand(short, result)
for (short_val, long_val) in abbrevs:
command_interpreter.ResolveCommand(short_val, result)
self.assertTrue(result.Succeeded())
self.assertEqual(long, result.GetOutput())
self.assertEqual(long_val, result.GetOutput())

View File

@ -182,7 +182,7 @@ class ArrayTypesTestCase(TestBase):
"Variable 'long_6' should have 6 children")
child5 = variable.GetChildAtIndex(5)
self.DebugSBValue(child5)
self.assertTrue(long(child5.GetValue(), 0) == 6,
self.assertTrue(int(child5.GetValue(), 0) == 6,
"long_6[5] == 6")
# Last, check that "long_6" has a value type of eValueTypeVariableLocal

View File

@ -1,5 +1,8 @@
import lldb_shared
import curses, curses.panel
import sys
import six
import time
class Point(object):
@ -138,7 +141,7 @@ class Window(object):
for key in arg:
self.add_key_action(key, callback, description)
else:
if isinstance(arg, ( int, long )):
if isinstance(arg, six.integer_types):
key_action_dict = { 'key' : arg,
'callback' : callback,
'description' : decription }

View File

@ -220,8 +220,8 @@ class SBDataAPICase(TestBase):
self.assertTrue(data2.uint8[4] == 111, 'o == 111')
self.assert_data(data2.GetUnsignedInt8, 5, 33) # !
uint_lists = [ [1,2,3,4,5], [long(i) for i in [1, 2, 3, 4, 5]] ]
int_lists = [ [2, -2], [long(i) for i in [2, -2]] ]
uint_lists = [ [1,2,3,4,5], [int(i) for i in [1, 2, 3, 4, 5]] ]
int_lists = [ [2, -2], [int(i) for i in [2, -2]] ]
for l in uint_lists:
data2 = lldb.SBData.CreateDataFromUInt64Array(process.GetByteOrder(), process.GetAddressByteSize(), l)

View File

@ -9,6 +9,7 @@ import os
import os.path
import platform
import re
import six
import socket_packet_pump
import subprocess
import time
@ -808,8 +809,8 @@ def process_is_running(pid, unknown_value=True):
If we don't know how to check running process ids on the given OS:
return the value provided by the unknown_value arg.
"""
if type(pid) not in [int, long]:
raise Exception("pid must be of type int (actual type: %s)" % str(type(pid)))
if not isinstance(pid, six.integer_types):
raise Exception("pid must be an integral type (actual type: %s)" % str(type(pid)))
process_ids = []