Skip to content

Commit

Permalink
scripts/gdb: fix python 3.8 SyntaxWarning
Browse files Browse the repository at this point in the history
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 <ndesaulniers@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Kieran Bingham <kbingham@kernel.org>
Cc: Aymeric Agon-Rambosson <aymeric.agon@yandex.com>
Link: http://lkml.kernel.org/r/20200805225015.2847624-1-ndesaulniers@google.com
Link: https://adamj.eu/tech/2020/01/21/why-does-python-3-8-syntaxwarning-for-is-literal/
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Nick Desaulniers authored and Linus Torvalds committed Aug 12, 2020
1 parent fed79d0 commit a3ec9f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/gdb/linux/rbtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def rb_first(root):
raise gdb.GdbError("Must be struct rb_root not {}".format(root.type))

node = root['rb_node']
if node is 0:
if node == 0:
return None

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

node = root['rb_node']
if node is 0:
if node == 0:
return None

while node['rb_right']:
Expand Down

0 comments on commit a3ec9f3

Please sign in to comment.