Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 449ca0c95ea2 ("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>

authored by

Nick Desaulniers and committed by
Linus Torvalds
a3ec9f38 fed79d05

+2 -2
+2 -2
scripts/gdb/linux/rbtree.py
··· 17 17 raise gdb.GdbError("Must be struct rb_root not {}".format(root.type)) 18 18 19 19 node = root['rb_node'] 20 - if node is 0: 20 + if node == 0: 21 21 return None 22 22 23 23 while node['rb_left']: ··· 33 33 raise gdb.GdbError("Must be struct rb_root not {}".format(root.type)) 34 34 35 35 node = root['rb_node'] 36 - if node is 0: 36 + if node == 0: 37 37 return None 38 38 39 39 while node['rb_right']: