https://github.com/e-kwsm updated
https://github.com/llvm/llvm-project/pull/94017
>From a10dbbe288bdb115df56ef60c48f9efbf6642bd3 Mon Sep 17 00:00:00 2001
From: Eisuke Kawashima
Date: Sat, 11 May 2024 23:57:11 +0900
Subject: [PATCH] fix(lldb/**.py): fix comparison to None
from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations):
> Comparisons to singletons like None should always be done with is or
> is not, never the equality operators.
---
lldb/bindings/interface/SBBreakpointDocstrings.i | 2 +-
lldb/bindings/interface/SBDataExtensions.i| 8
lldb/docs/use/python.rst | 4 ++--
lldb/examples/python/armv7_cortex_m_target_defintion.py | 2 +-
lldb/packages/Python/lldbsuite/test/dotest.py | 2 +-
lldb/packages/Python/lldbsuite/test/lldbtest.py | 6 +++---
lldb/packages/Python/lldbsuite/test/lldbutil.py | 6 +++---
.../lldbsuite/test/tools/intelpt/intelpt_testcase.py | 2 +-
.../address_breakpoints/TestBadAddressBreakpoints.py | 2 +-
.../API/functionalities/step_scripted/TestStepScripted.py | 2 +-
.../TestStopOnSharedlibraryEvents.py | 2 +-
lldb/test/API/lua_api/TestLuaAPI.py | 2 +-
.../macosx/thread_suspend/TestInternalThreadSuspension.py | 2 +-
lldb/test/API/python_api/event/TestEvents.py | 2 +-
.../process/read-mem-cstring/TestReadMemCString.py| 2 +-
lldb/test/API/python_api/type/TestTypeList.py | 2 +-
lldb/test/API/python_api/was_interrupted/interruptible.py | 2 +-
lldb/test/Shell/lit.cfg.py| 2 +-
18 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/lldb/bindings/interface/SBBreakpointDocstrings.i
b/lldb/bindings/interface/SBBreakpointDocstrings.i
index 74c139d5d9fb6..dca2819a9927b 100644
--- a/lldb/bindings/interface/SBBreakpointDocstrings.i
+++ b/lldb/bindings/interface/SBBreakpointDocstrings.i
@@ -39,7 +39,7 @@ TestBreakpointIgnoreCount.py),::
#lldbutil.print_stacktraces(process)
from lldbutil import get_stopped_thread
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-self.assertTrue(thread != None, 'There should be a thread stopped due
to breakpoint')
+self.assertTrue(thread is not None, 'There should be a thread stopped
due to breakpoint')
frame0 = thread.GetFrameAtIndex(0)
frame1 = thread.GetFrameAtIndex(1)
frame2 = thread.GetFrameAtIndex(2)
diff --git a/lldb/bindings/interface/SBDataExtensions.i
b/lldb/bindings/interface/SBDataExtensions.i
index d980e79221c6d..ddea77a088dfa 100644
--- a/lldb/bindings/interface/SBDataExtensions.i
+++ b/lldb/bindings/interface/SBDataExtensions.i
@@ -40,19 +40,19 @@ STRING_EXTENSION_OUTSIDE(SBData)
lldbtarget = lldbdict['target']
else:
lldbtarget = None
-if target == None and lldbtarget != None and lldbtarget.IsValid():
+if target is None and lldbtarget is not None and
lldbtarget.IsValid():
target = lldbtarget
-if ptr_size == None:
+if ptr_size is None:
if target and target.IsValid():
ptr_size = target.addr_size
else:
ptr_size = 8
-if endian == None:
+if endian is None:
if target and target.IsValid():
endian = target.byte_order
else:
endian = lldbdict['eByteOrderLittle']
-if size == None:
+if size is None:
if value > 2147483647:
size = 8
elif value < -2147483648:
diff --git a/lldb/docs/use/python.rst b/lldb/docs/use/python.rst
index 6183d6935d80e..d9c29d95708c1 100644
--- a/lldb/docs/use/python.rst
+++ b/lldb/docs/use/python.rst
@@ -75,13 +75,13 @@ later explanations:
12: if root_word == word:
13: return cur_path
14: elif word < root_word:
- 15: if left_child_ptr.GetValue() == None:
+ 15: if left_child_ptr.GetValue() is None:
16: return ""
17: else:
18: cur_path = cur_path + "L"
19: return DFS (left_child_ptr, word, cur_path)
20: else:
- 21: if right_child_ptr.GetValue() == None:
+ 21: if right_child_ptr.GetValue() is None:
22: return ""
23: else:
24: cur_path = cur_path + "R"
diff --git a/lldb/examples/python/armv7_cortex_m_target_defintion.py
b/lldb/examples/python/armv7_cortex_m_target_defintion.py
index 42eaa39993dae..8225670f33e6b 100755
--- a/lldb/examples/python/armv7_cortex_m_target_defintion.py
+++ b/lldb/examples/python/armv7_cortex_m_target_defintion.py
@@ -222,7 +222,7 @@ def get_reg_num(reg_num_dict, reg_name):
def get_target_definition():
global g_target_defini