Skip to content

Commit a3ec9f3

Browse files
nickdesaulnierstorvalds
authored andcommitted
scripts/gdb: fix python 3.8 SyntaxWarning
Fixes the observed warnings: scripts/gdb/linux/rbtree.py:20: SyntaxWarning: "is" with a literal. Did you mean "=="? if node is 0: scripts/gdb/linux/rbtree.py:36: SyntaxWarning: "is" with a literal. Did you mean "=="? if node is 0: It looks like this is a new warning added in Python 3.8. I've only seen this once after adding the add-auto-load-safe-path rule to my ~/.gdbinit for a new tree. Fixes: commit 449ca0c ("scripts/gdb: add rb tree iterating utilities") Signed-off-by: Nick Desaulniers <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Cc: Jan Kiszka <[email protected]> Cc: Kieran Bingham <[email protected]> Cc: Aymeric Agon-Rambosson <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Link: https://adamj.eu/tech/2020/01/21/why-does-python-3-8-syntaxwarning-for-is-literal/ Signed-off-by: Linus Torvalds <[email protected]>
1 parent fed79d0 commit a3ec9f3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/gdb/linux/rbtree.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def rb_first(root):
1717
raise gdb.GdbError("Must be struct rb_root not {}".format(root.type))
1818

1919
node = root['rb_node']
20-
if node is 0:
20+
if node == 0:
2121
return None
2222

2323
while node['rb_left']:
@@ -33,7 +33,7 @@ def rb_last(root):
3333
raise gdb.GdbError("Must be struct rb_root not {}".format(root.type))
3434

3535
node = root['rb_node']
36-
if node is 0:
36+
if node == 0:
3737
return None
3838

3939
while node['rb_right']:

0 commit comments

Comments
 (0)