]> Git Repo - linux.git/commitdiff
scripts/gdb: fix python 3.8 SyntaxWarning
authorNick Desaulniers <[email protected]>
Wed, 12 Aug 2020 01:37:02 +0000 (18:37 -0700)
committerLinus Torvalds <[email protected]>
Wed, 12 Aug 2020 17:58:02 +0000 (10:58 -0700)
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 <[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]>
scripts/gdb/linux/rbtree.py

index c4b99160791785e5b346b0a86e8cb4e28f182b2d..fe462855eefda383a1708ad2cd1941b1358cbe59 100644 (file)
@@ -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']:
@@ -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']:
This page took 0.058684 seconds and 4 git commands to generate.