0006-Fix-incorrect-use-of-is-operator-for-comparison-in-p.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From e00c211d51bec301cf04719b77076a8783ef44b5 Mon Sep 17 00:00:00 2001
  2. From: Raul Tambre <raul@tambre.ee>
  3. Date: Sat, 4 May 2019 15:48:17 -0400
  4. Subject: [PATCH] Fix incorrect use of 'is' operator for comparison in
  5. python/lib/gdb/command/prompt.py
  6. The 'is' operator is not meant to be used for comparisons. It currently working
  7. is an implementation detail of CPython. CPython 3.8 has added a SyntaxWarning
  8. for this.
  9. (cherry picked from commit b6484282f85bf7f11451b2441599c241d302ad9d)
  10. [Romain: backport to gdb 8.x]
  11. Signed-off-by: Romain Naour <romain.naour@gmail.com>
  12. ---
  13. gdb/python/lib/gdb/command/prompt.py | 4 ++--
  14. 1 file changed, 2 insertions(+), 2 deletions(-)
  15. diff --git a/gdb/python/lib/gdb/command/prompt.py b/gdb/python/lib/gdb/command/prompt.py
  16. index 3d662a7d3f..04b9e49c22 100644
  17. --- a/gdb/python/lib/gdb/command/prompt.py
  18. +++ b/gdb/python/lib/gdb/command/prompt.py
  19. @@ -45,7 +45,7 @@ The currently defined substitutions are:
  20. self.hook_set = False
  21. def get_show_string (self, pvalue):
  22. - if self.value is not '':
  23. + if self.value:
  24. return "The extended prompt is: " + self.value
  25. else:
  26. return "The extended prompt is not set."
  27. @@ -57,7 +57,7 @@ The currently defined substitutions are:
  28. return ""
  29. def before_prompt_hook(self, current):
  30. - if self.value is not '':
  31. + if self.value:
  32. return gdb.prompt.substitute_prompt(self.value)
  33. else:
  34. return None
  35. --
  36. 2.25.4