Skip to contentSkip to conversation

package/gdb: fix gdb python support with python 3.8

PATCH New Romain Naour 3 participants 3 messages Jun 23, 2020 – Jul 16, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/gdb: fix gdb python support with python 3.8

CPython 3.8 has added a new Syntax Warning that print a waring at runtime while unsing gdb python support.

$ gdb -ex "python import os"
/usr/share/gdb/python/gdb/command/prompt.py:48: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if self.value is not '':
/usr/share/gdb/python/gdb/command/prompt.py:60: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if self.value is not '':

Backport an upstream patch for this:
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=b6484282f85bf7f11451b2441599c241d302ad9d

---
 ...e-of-is-operator-for-comparison-in-p.patch | 42 +++++++++++++++++++
 ...e-of-is-operator-for-comparison-in-p.patch | 42 +++++++++++++++++++
 ...e-of-is-operator-for-comparison-in-p.patch | 42 +++++++++++++++++++
 3 files changed, 126 insertions(+)
 create mode 100644 package/gdb/8.1.1/0008-Fix-incorrect-use-of-is-operator-for-comparison-in-p.patch
 create mode 100644 package/gdb/8.2.1/0006-Fix-incorrect-use-of-is-operator-for-comparison-in-p.patch
 create mode 100644 package/gdb/8.3.1/0006-Fix-incorrect-use-of-is-operator-for-comparison-in-p.patch
package/gdb/8.1.1/0008-Fix-incorrect-use-of-is-operator-for-comparison-in-p.patch new file +42 -0
new file mode 100644
index 0000000000..989a5b1347
@@ -0,0 +1,42 @@
+From e00c211d51bec301cf04719b77076a8783ef44b5 Mon Sep 17 00:00:00 2001
+From: Raul Tambre <[email protected]>
+Date: Sat, 4 May 2019 15:48:17 -0400
+Subject: [PATCH] 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.
+
+(cherry picked from commit b6484282f85bf7f11451b2441599c241d302ad9d)
+[Romain: backport to gdb 8.x]
+Signed-off-by: Romain Naour <[email protected]>
+---
+ gdb/python/lib/gdb/command/prompt.py | 4 ++--
+ 1 file changed, 2 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
+-- 
+2.25.4
+
package/gdb/8.2.1/0006-Fix-incorrect-use-of-is-operator-for-comparison-in-p.patch new file +42 -0

42 lines not on this page · raw message

package/gdb/8.3.1/0006-Fix-incorrect-use-of-is-operator-for-comparison-in-p.patch new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.25.4
#1 lore raw

PATCH 1/1 package/gdb: fix gdb python support with python 3.8

Romain, All,

On 2020-06-23 15:16 +0200, Romain Naour spake thusly:

Quoted 9 lines

CPython 3.8 has added a new Syntax Warning that print a waring at runtime while unsing gdb python support.

$ gdb -ex "python import os"
/usr/share/gdb/python/gdb/command/prompt.py:48: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if self.value is not '':
/usr/share/gdb/python/gdb/command/prompt.py:60: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if self.value is not '':
Quoted 4 lines

Backport an upstream patch for this:
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=b6484282f85bf7f11451b2441599c241d302ad9d

Applied to master, thanks.

Regards,
Yann E. MORIN.

Quoted 160 lines
---
 ...e-of-is-operator-for-comparison-in-p.patch | 42 +++++++++++++++++++
 ...e-of-is-operator-for-comparison-in-p.patch | 42 +++++++++++++++++++
 ...e-of-is-operator-for-comparison-in-p.patch | 42 +++++++++++++++++++
 3 files changed, 126 insertions(+)
 create mode 100644 package/gdb/8.1.1/0008-Fix-incorrect-use-of-is-operator-for-comparison-in-p.patch
 create mode 100644 package/gdb/8.2.1/0006-Fix-incorrect-use-of-is-operator-for-comparison-in-p.patch
 create mode 100644 package/gdb/8.3.1/0006-Fix-incorrect-use-of-is-operator-for-comparison-in-p.patch
package/gdb/8.1.1/0008-Fix-incorrect-use-of-is-operator-for-comparison-in-p.patch new file +42 -0
new file mode 100644
index 0000000000..989a5b1347
@@ -0,0 +1,42 @@
+From e00c211d51bec301cf04719b77076a8783ef44b5 Mon Sep 17 00:00:00 2001
+From: Raul Tambre <[email protected]>
+Date: Sat, 4 May 2019 15:48:17 -0400
+Subject: [PATCH] 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.
+
+(cherry picked from commit b6484282f85bf7f11451b2441599c241d302ad9d)
+[Romain: backport to gdb 8.x]
+Signed-off-by: Romain Naour <[email protected]>
+---
+ gdb/python/lib/gdb/command/prompt.py | 4 ++--
+ 1 file changed, 2 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
+-- 
+2.25.4
+
package/gdb/8.2.1/0006-Fix-incorrect-use-of-is-operator-for-comparison-in-p.patch new file +42 -0
new file mode 100644
index 0000000000..989a5b1347
@@ -0,0 +1,42 @@
+From e00c211d51bec301cf04719b77076a8783ef44b5 Mon Sep 17 00:00:00 2001
+From: Raul Tambre <[email protected]>
+Date: Sat, 4 May 2019 15:48:17 -0400
+Subject: [PATCH] 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.
+
+(cherry picked from commit b6484282f85bf7f11451b2441599c241d302ad9d)
+[Romain: backport to gdb 8.x]
+Signed-off-by: Romain Naour <[email protected]>
+---
+ gdb/python/lib/gdb/command/prompt.py | 4 ++--
+ 1 file changed, 2 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
+-- 
+2.25.4
+
package/gdb/8.3.1/0006-Fix-incorrect-use-of-is-operator-for-comparison-in-p.patch new file +42 -0
new file mode 100644
index 0000000000..989a5b1347
@@ -0,0 +1,42 @@
+From e00c211d51bec301cf04719b77076a8783ef44b5 Mon Sep 17 00:00:00 2001
+From: Raul Tambre <[email protected]>
+Date: Sat, 4 May 2019 15:48:17 -0400
+Subject: [PATCH] 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.
+
+(cherry picked from commit b6484282f85bf7f11451b2441599c241d302ad9d)
+[Romain: backport to gdb 8.x]
+Signed-off-by: Romain Naour <[email protected]>
+---
+ gdb/python/lib/gdb/command/prompt.py | 4 ++--
+ 1 file changed, 2 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
+-- 
+2.25.4
+
Signature · 6 lines
2.25.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 package/gdb: fix gdb python support with python 3.8

In reply to Romain Naour
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Romain" == Romain Naour <[email protected]> writes:

CPython 3.8 has added a new Syntax Warning that print a waring at runtime while unsing gdb python support.

$ gdb -ex "python import os"
/usr/share/gdb/python/gdb/command/prompt.py:48: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if self.value is not '':
/usr/share/gdb/python/gdb/command/prompt.py:60: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if self.value is not '':
Quoted 4 lines

Backport an upstream patch for this:
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=b6484282f85bf7f11451b2441599c241d302ad9d

Committed to 2020.05.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard