From f0e22c3fc63fcbb5ac9419787ce50ad4547546bf27611fd0d7207ffb5e3a3612 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Tue, 21 Apr 2020 15:10:19 +0000 Subject: [PATCH] Accepting request 795972 from home:tomdevries:branches:devel:gcc-gdb-gdb-emacs-python - Fix python 3.8 warning [bsc#1169495]. * gdb-fix-incorrect-use-of-is-operator-for-comparison-in-python-lib-gdb-command-prompt.py.patch OBS-URL: https://build.opensuse.org/request/show/795972 OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=247 --- ...-in-python-lib-gdb-command-prompt.py.patch | 32 +++++++++++++++++++ gdb.changes | 6 ++++ gdb.spec | 2 ++ 3 files changed, 40 insertions(+) create mode 100644 gdb-fix-incorrect-use-of-is-operator-for-comparison-in-python-lib-gdb-command-prompt.py.patch diff --git a/gdb-fix-incorrect-use-of-is-operator-for-comparison-in-python-lib-gdb-command-prompt.py.patch b/gdb-fix-incorrect-use-of-is-operator-for-comparison-in-python-lib-gdb-command-prompt.py.patch new file mode 100644 index 0000000..9aea6ef --- /dev/null +++ b/gdb-fix-incorrect-use-of-is-operator-for-comparison-in-python-lib-gdb-command-prompt.py.patch @@ -0,0 +1,32 @@ +Fix incorrect use of 'is' operator for comparison in python/lib/gdb/command/prompt.py + +The 'is' operator is not meant to be used for comparisons. It currently working +is an implementation detail of CPython. CPython 3.8 has added a SyntaxWarning +for this. + +--- + gdb/python/lib/gdb/command/prompt.py | 4 ++-- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/gdb/python/lib/gdb/command/prompt.py b/gdb/python/lib/gdb/command/prompt.py +index 3d662a7d3f..04b9e49c22 100644 +--- a/gdb/python/lib/gdb/command/prompt.py ++++ b/gdb/python/lib/gdb/command/prompt.py +@@ -45,7 +45,7 @@ The currently defined substitutions are: + self.hook_set = False + + def get_show_string (self, pvalue): +- if self.value is not '': ++ if self.value: + return "The extended prompt is: " + self.value + else: + return "The extended prompt is not set." +@@ -57,7 +57,7 @@ The currently defined substitutions are: + return "" + + def before_prompt_hook(self, current): +- if self.value is not '': ++ if self.value: + return gdb.prompt.substitute_prompt(self.value) + else: + return None diff --git a/gdb.changes b/gdb.changes index c8b6568..3cc99fe 100644 --- a/gdb.changes +++ b/gdb.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Apr 20 14:29:12 UTC 2020 - Tom de Vries + +- Fix python 3.8 warning [bsc#1169495]. + * gdb-fix-incorrect-use-of-is-operator-for-comparison-in-python-lib-gdb-command-prompt.py.patch + ------------------------------------------------------------------- Tue Apr 14 07:40:12 UTC 2020 - Tom de Vries diff --git a/gdb.spec b/gdb.spec index 1dfced0..d84f6e1 100644 --- a/gdb.spec +++ b/gdb.spec @@ -252,6 +252,7 @@ Patch2013: gdb-arch13-1.diff Patch2014: gdb-arch13-2.diff Patch2015: gdb-arch13-3.diff Patch2016: bfd-change-num_group-to-unsigned-int.patch +Patch2017: gdb-fix-incorrect-use-of-is-operator-for-comparison-in-python-lib-gdb-command-prompt.py.patch # Proposed patch for PR symtab/24971 Patch2500: gdb-symtab-prefer-var-def-over-decl.patch @@ -612,6 +613,7 @@ find -name "*.info*"|xargs rm -f %patch2014 -p1 %patch2015 -p1 %patch2016 -p1 +%patch2017 -p1 %patch2500 -p1 %patch2501 -p1