[Lldb-commits] [lldb] f54497f - [lldb] Remove basestring references in examples (NFC)

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 13 11:10:39 PST 2022


Author: Dave Lee
Date: 2022-12-13T11:10:11-08:00
New Revision: f54497f114b9b5acaa8ebff296594b2cd7e437dd

URL: https://github.com/llvm/llvm-project/commit/f54497f114b9b5acaa8ebff296594b2cd7e437dd
DIFF: https://github.com/llvm/llvm-project/commit/f54497f114b9b5acaa8ebff296594b2cd7e437dd.diff

LOG: [lldb] Remove basestring references in examples (NFC)

`basestring` is Python 2 only.

Added: 
    

Modified: 
    lldb/examples/summaries/cocoa/CFArray.py
    lldb/examples/summaries/cocoa/CFBag.py
    lldb/examples/summaries/cocoa/CFBinaryHeap.py
    lldb/examples/summaries/cocoa/CFDictionary.py
    lldb/examples/summaries/cocoa/NSData.py
    lldb/examples/summaries/cocoa/NSIndexSet.py
    lldb/examples/summaries/cocoa/NSMachPort.py
    lldb/examples/summaries/cocoa/NSSet.py

Removed: 
    


################################################################################
diff  --git a/lldb/examples/summaries/cocoa/CFArray.py b/lldb/examples/summaries/cocoa/CFArray.py
index baf1ca30ce0e6..e3916011bd8ac 100644
--- a/lldb/examples/summaries/cocoa/CFArray.py
+++ b/lldb/examples/summaries/cocoa/CFArray.py
@@ -13,11 +13,6 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
-try:
-    basestring
-except NameError:
-    basestring = str
-
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
@@ -222,7 +217,7 @@ def CFArray_SummaryProvider(valobj, dict):
         logger >> "provider gave me " + str(summary)
         if summary is None:
             summary = '<variable is not NSArray>'
-        elif isinstance(summary, basestring):
+        elif isinstance(summary, str):
             pass
         else:
             # we format it like it were a CFString to make it look the same as

diff  --git a/lldb/examples/summaries/cocoa/CFBag.py b/lldb/examples/summaries/cocoa/CFBag.py
index 55c3fe6b68f52..6a75b0222abb1 100644
--- a/lldb/examples/summaries/cocoa/CFBag.py
+++ b/lldb/examples/summaries/cocoa/CFBag.py
@@ -13,11 +13,6 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
-try:
-    basestring
-except NameError:
-    basestring = str
-
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
@@ -150,7 +145,7 @@ def CFBag_SummaryProvider(valobj, dict):
         #  the mask needs to be changed)
         if summary is None:
             summary = '<variable is not CFBag>'
-        elif isinstance(summary, basestring):
+        elif isinstance(summary, str):
             pass
         else:
             if provider.sys_params.is_64_bit:

diff  --git a/lldb/examples/summaries/cocoa/CFBinaryHeap.py b/lldb/examples/summaries/cocoa/CFBinaryHeap.py
index 061ab61ae4c55..f22a044b6811e 100644
--- a/lldb/examples/summaries/cocoa/CFBinaryHeap.py
+++ b/lldb/examples/summaries/cocoa/CFBinaryHeap.py
@@ -13,11 +13,6 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
-try:
-    basestring
-except NameError:
-    basestring = str
-
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
@@ -148,7 +143,7 @@ def CFBinaryHeap_SummaryProvider(valobj, dict):
         #  the mask needs to be changed)
         if summary is None:
             summary = '<variable is not CFBinaryHeap>'
-        elif isinstance(summary, basestring):
+        elif isinstance(summary, str):
             pass
         else:
             if provider.sys_params.is_64_bit:

diff  --git a/lldb/examples/summaries/cocoa/CFDictionary.py b/lldb/examples/summaries/cocoa/CFDictionary.py
index 6fcc0a6fe7712..fa132605cb185 100644
--- a/lldb/examples/summaries/cocoa/CFDictionary.py
+++ b/lldb/examples/summaries/cocoa/CFDictionary.py
@@ -13,11 +13,6 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
-try:
-    basestring
-except NameError
-    basestring = str
-
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
@@ -227,7 +222,7 @@ def CFDictionary_SummaryProvider(valobj, dict):
         logger >> "got summary " + str(summary)
         if summary is None:
             return '<variable is not NSDictionary>'
-        if isinstance(summary, basestring):
+        if isinstance(summary, str):
             return summary
         return str(summary) + (" key/value pairs" if summary !=
                                1 else " key/value pair")
@@ -249,7 +244,7 @@ def CFDictionary_SummaryProvider2(valobj, dict):
         logger >> "got summary " + str(summary)
         if summary is None:
             summary = '<variable is not CFDictionary>'
-        if isinstance(summary, basestring):
+        if isinstance(summary, str):
             return summary
         else:
             # needed on OSX Mountain Lion

diff  --git a/lldb/examples/summaries/cocoa/NSData.py b/lldb/examples/summaries/cocoa/NSData.py
index 005a1cac50ced..d6edabbc23164 100644
--- a/lldb/examples/summaries/cocoa/NSData.py
+++ b/lldb/examples/summaries/cocoa/NSData.py
@@ -13,11 +13,6 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
-try:
-    basestring
-except NameError:
-    basestring = str
-
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
@@ -141,7 +136,7 @@ def NSData_SummaryProvider(valobj, dict):
         logger >> "got a summary: it is " + str(summary)
         if summary is None:
             summary = '<variable is not NSData>'
-        elif isinstance(summary, basestring):
+        elif isinstance(summary, str):
             pass
         else:
             if summary == 1:
@@ -169,7 +164,7 @@ def NSData_SummaryProvider2(valobj, dict):
         logger >> "got a summary: it is " + str(summary)
         if summary is None:
             summary = '<variable is not CFData>'
-        elif isinstance(summary, basestring):
+        elif isinstance(summary, str):
             pass
         else:
             if summary == 1:

diff  --git a/lldb/examples/summaries/cocoa/NSIndexSet.py b/lldb/examples/summaries/cocoa/NSIndexSet.py
index 25588350c1103..5ec549545327d 100644
--- a/lldb/examples/summaries/cocoa/NSIndexSet.py
+++ b/lldb/examples/summaries/cocoa/NSIndexSet.py
@@ -13,11 +13,6 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
-try:
-    basestring
-except NameError:
-    basestring = str
-
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
@@ -168,7 +163,7 @@ def NSIndexSet_SummaryProvider(valobj, dict):
         logger >> "got summary " + str(summary)
         if summary is None:
             summary = '<variable is not NSIndexSet>'
-        if isinstance(summary, basestring):
+        if isinstance(summary, str):
             return summary
         else:
             summary = str(summary) + (' indexes' if summary != 1 else ' index')

diff  --git a/lldb/examples/summaries/cocoa/NSMachPort.py b/lldb/examples/summaries/cocoa/NSMachPort.py
index 624b34350de50..25488138dfc76 100644
--- a/lldb/examples/summaries/cocoa/NSMachPort.py
+++ b/lldb/examples/summaries/cocoa/NSMachPort.py
@@ -13,11 +13,6 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
-try:
-    basestring
-except NameError:
-    basestring =str
-
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
@@ -135,7 +130,7 @@ def NSMachPort_SummaryProvider(valobj, dict):
         logger >> "got summary " + str(summary)
         if summary is None:
             summary = '<variable is not NSMachPort>'
-        if isinstance(summary, basestring):
+        if isinstance(summary, str):
             return summay
         return 'mach port: ' + str(summary)
     return 'Summary Unavailable'

diff  --git a/lldb/examples/summaries/cocoa/NSSet.py b/lldb/examples/summaries/cocoa/NSSet.py
index 27cdd302c3417..e3a6a1de896b2 100644
--- a/lldb/examples/summaries/cocoa/NSSet.py
+++ b/lldb/examples/summaries/cocoa/NSSet.py
@@ -13,11 +13,6 @@
 import CFBag
 import lldb.formatters.Logger
 
-try:
-    basestring
-except NameError:
-    basestring = str
-
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
@@ -247,7 +242,7 @@ def NSSet_SummaryProvider(valobj, dict):
             summary = None
         if summary is None:
             summary = '<variable is not NSSet>'
-        if isinstance(summary, basestring):
+        if isinstance(summary, str):
             return summary
         else:
             summary = str(summary) + \
@@ -276,7 +271,7 @@ def NSSet_SummaryProvider2(valobj, dict):
         #                  the mask needs to be changed)
         if summary is None:
             summary = '<variable is not CFSet>'
-        if isinstance(summary, basestring):
+        if isinstance(summary, str):
             return summary
         else:
             if provider.sys_params.is_64_bit:


        


More information about the lldb-commits mailing list