[Lldb-commits] [lldb] r156639 - in /lldb/trunk/scripts/Python/interface: SBBlock.i SBData.i SBInstructionList.i SBModule.i SBProcess.i SBSymbolContextList.i SBTarget.i SBThread.i SBValueList.i

Filipe Cabecinhas me at filcab.net
Fri May 11 13:39:42 PDT 2012


Author: filcab
Date: Fri May 11 15:39:42 2012
New Revision: 156639

URL: http://llvm.org/viewvc/llvm-project?rev=156639&view=rev
Log:
Make every Python API __len__() method return a PyIntObject.

swig 2.0+ seems to default to using PyLongObjects, but the __len__()
method _must_ return a PyIntObject.

Modified:
    lldb/trunk/scripts/Python/interface/SBBlock.i
    lldb/trunk/scripts/Python/interface/SBData.i
    lldb/trunk/scripts/Python/interface/SBInstructionList.i
    lldb/trunk/scripts/Python/interface/SBModule.i
    lldb/trunk/scripts/Python/interface/SBProcess.i
    lldb/trunk/scripts/Python/interface/SBSymbolContextList.i
    lldb/trunk/scripts/Python/interface/SBTarget.i
    lldb/trunk/scripts/Python/interface/SBThread.i
    lldb/trunk/scripts/Python/interface/SBValueList.i

Modified: lldb/trunk/scripts/Python/interface/SBBlock.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBBlock.i?rev=156639&r1=156638&r2=156639&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBBlock.i (original)
+++ lldb/trunk/scripts/Python/interface/SBBlock.i Fri May 11 15:39:42 2012
@@ -116,7 +116,7 @@
         
             def __len__(self):
                 if self.sbblock:
-                    return self.sbblock.GetNumRanges()
+                    return int(self.sbblock.GetNumRanges())
                 return 0
         
             def __getitem__(self, key):

Modified: lldb/trunk/scripts/Python/interface/SBData.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBData.i?rev=156639&r1=156638&r2=156639&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBData.i (original)
+++ lldb/trunk/scripts/Python/interface/SBData.i Fri May 11 15:39:42 2012
@@ -156,7 +156,7 @@
                 else:
                     return my_data
             def __len__(self):
-                return self.sbdata.GetByteSize()/self.item_size
+                return int(self.sbdata.GetByteSize()/self.item_size)
             def all(self):
                 return self[0:len(self)]
         

Modified: lldb/trunk/scripts/Python/interface/SBInstructionList.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBInstructionList.i?rev=156639&r1=156638&r2=156639&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBInstructionList.i (original)
+++ lldb/trunk/scripts/Python/interface/SBInstructionList.i Fri May 11 15:39:42 2012
@@ -62,7 +62,7 @@
     %pythoncode %{
         def __len__(self):
             '''Access len of the instruction list.'''
-            return self.GetSize();
+            return int(self.GetSize())
 
         def __getitem__(self, key):
             '''Access instructions by integer index.'''

Modified: lldb/trunk/scripts/Python/interface/SBModule.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBModule.i?rev=156639&r1=156638&r2=156639&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBModule.i (original)
+++ lldb/trunk/scripts/Python/interface/SBModule.i Fri May 11 15:39:42 2012
@@ -259,7 +259,7 @@
         
             def __len__(self):
                 if self.sbmodule:
-                    return self.sbmodule.GetNumSymbols()
+                    return int(self.sbmodule.GetNumSymbols())
                 return 0
         
             def __getitem__(self, key):
@@ -315,7 +315,7 @@
         
             def __len__(self):
                 if self.sbmodule:
-                    return self.sbmodule.GetNumSections()
+                    return int(self.sbmodule.GetNumSections())
                 return 0
         
             def __getitem__(self, key):

Modified: lldb/trunk/scripts/Python/interface/SBProcess.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBProcess.i?rev=156639&r1=156638&r2=156639&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBProcess.i (original)
+++ lldb/trunk/scripts/Python/interface/SBProcess.i Fri May 11 15:39:42 2012
@@ -321,7 +321,8 @@
                 self.sbprocess = sbprocess
         
             def __len__(self):
-                if self.sbprocess: return self.sbprocess.GetNumThreads()
+                if self.sbprocess:
+                    return int(self.sbprocess.GetNumThreads())
                 return 0
         
             def __getitem__(self, key):

Modified: lldb/trunk/scripts/Python/interface/SBSymbolContextList.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBSymbolContextList.i?rev=156639&r1=156638&r2=156639&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBSymbolContextList.i (original)
+++ lldb/trunk/scripts/Python/interface/SBSymbolContextList.i Fri May 11 15:39:42 2012
@@ -62,7 +62,7 @@
     
     %pythoncode %{
         def __len__(self):
-            return self.GetSize()
+            return int(self.GetSize())
 
         def __getitem__(self, key):
             count = len(self)

Modified: lldb/trunk/scripts/Python/interface/SBTarget.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTarget.i?rev=156639&r1=156638&r2=156639&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBTarget.i (original)
+++ lldb/trunk/scripts/Python/interface/SBTarget.i Fri May 11 15:39:42 2012
@@ -691,7 +691,7 @@
         
             def __len__(self):
                 if self.sbtarget:
-                    return self.sbtarget.GetNumModules()
+                    return int(self.sbtarget.GetNumModules())
                 return 0
         
             def __getitem__(self, key):

Modified: lldb/trunk/scripts/Python/interface/SBThread.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBThread.i?rev=156639&r1=156638&r2=156639&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBThread.i (original)
+++ lldb/trunk/scripts/Python/interface/SBThread.i Fri May 11 15:39:42 2012
@@ -182,7 +182,7 @@
 
             def __len__(self):
                 if self.sbthread:
-                    return self.sbthread.GetNumFrames()
+                    return int(self.sbthread.GetNumFrames())
                 return 0
             
             def __getitem__(self, key):

Modified: lldb/trunk/scripts/Python/interface/SBValueList.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBValueList.i?rev=156639&r1=156638&r2=156639&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBValueList.i (original)
+++ lldb/trunk/scripts/Python/interface/SBValueList.i Fri May 11 15:39:42 2012
@@ -98,8 +98,8 @@
     FindValueObjectByUID (lldb::user_id_t uid);
     %pythoncode %{
         def __len__(self):
-            return self.GetSize()
-        
+            return int(self.GetSize())
+
         def __getitem__(self, key):
             count = len(self)
             #------------------------------------------------------------





More information about the lldb-commits mailing list