Author: davide
Date: Tue Mar 12 17:48:29 2019
New Revision: 355998

URL: http://llvm.org/viewvc/llvm-project?rev=355998&view=rev
Log:
[Python] Fix another batch of python 2/python 3 portability issues.

Modified:
    lldb/trunk/examples/summaries/synth.py
    
lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py
    lldb/trunk/packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py
    lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py

Modified: lldb/trunk/examples/summaries/synth.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/synth.py?rev=355998&r1=355997&r2=355998&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/synth.py (original)
+++ lldb/trunk/examples/summaries/synth.py Tue Mar 12 17:48:29 2019
@@ -33,11 +33,8 @@ class PythonObjectSyntheticChildProvider
     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)

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py?rev=355998&r1=355997&r2=355998&view=diff
==============================================================================
--- 
lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py 
Tue Mar 12 17:48:29 2019
@@ -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.

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py?rev=355998&r1=355997&r2=355998&view=diff
==============================================================================
--- 
lldb/trunk/packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py 
Tue Mar 12 17:48:29 2019
@@ -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)

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py?rev=355998&r1=355997&r2=355998&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py 
Tue Mar 12 17:48:29 2019
@@ -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")


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to