[Lldb-commits] [lldb] r355998 - [Python] Fix another batch of python 2/python 3 portability issues.

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 13 07:39:57 PDT 2019


Probably. I can try doing that.

On Wed, Mar 13, 2019 at 2:38 AM Pavel Labath via lldb-commits
<lldb-commits at lists.llvm.org> wrote:
>
> On 13/03/2019 01:48, Davide Italiano via lldb-commits wrote:
> > 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))
>
> This looks like the kind of thing that could be placed into the seven.py
> module.
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


More information about the lldb-commits mailing list