[Python] Fix another batch of python 2/python 3 portability issues.

llvm-svn: 355998
This commit is contained in:
Davide Italiano 2019-03-13 00:48:29 +00:00
parent 750efba67c
commit ca715b6ea0
4 changed files with 21 additions and 10 deletions

View File

@ -33,11 +33,8 @@ class PythonObjectSyntheticChildProvider(object):
def gen_child(self, name, value):
data = None
type = None
if isinstance(value, int):
data = lldb.SBData.CreateDataFromUInt32Array(
self.bo, self.ps, [value])
type = self.value.target.GetBasicType(lldb.eBasicTypeInt)
elif isinstance(value, long):
import six
if isinstance(value, six.integer_types):
data = lldb.SBData.CreateDataFromUInt64Array(
self.bo, self.ps, [value])
type = self.value.target.GetBasicType(lldb.eBasicTypeLong)

View File

@ -60,8 +60,13 @@ class DarwinNSLogOutputTestCase(TestBase):
# So that the child gets torn down after the test.
import pexpect
self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec,
self.lldbOption, exe))
import sys
if sys.version_info.major == 3:
self.child = pexpect.spawnu('%s %s %s' % (lldbtest_config.lldbExec,
self.lldbOption, exe))
else:
self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec,
self.lldbOption, exe))
child = self.child
# Turn on logging for what the child sends back.

View File

@ -42,7 +42,11 @@ class TestSTTYBeforeAndAfter(TestBase):
lldb_prompt = "(lldb) "
# So that the child gets torn down after the test.
self.child = pexpect.spawn('expect')
import sys
if sys.version_info.major == 3:
self.child = pexpect.spawnu('expect')
else:
self.child = pexpect.spawn('expect')
child = self.child
child.expect(expect_prompt)

View File

@ -42,8 +42,13 @@ class MiTestCaseBase(Base):
def spawnLldbMi(self, exe=None, args=None, preconfig=True):
import pexpect
self.child = pexpect.spawn("%s --interpreter %s" % (
self.lldbMiExec, args if args else ""), cwd=self.getBuildDir())
import sys
if sys.version_info.major == 3:
self.child = pexpect.spawnu("%s --interpreter %s" % (
self.lldbMiExec, args if args else ""), cwd=self.getBuildDir())
else:
self.child = pexpect.spawn("%s --interpreter %s" % (
self.lldbMiExec, args if args else ""), cwd=self.getBuildDir())
self.child.setecho(True)
self.mylog = self.getBuildArtifact("child.log")
self.child.logfile_read = open(self.mylog, "w")