public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Use raw strings on gdb.python/py-xmethods.exp (and fix Python 3.8's "SyntaxWarning: invalid escape s
@ 2019-08-26 13:19 Sergio Durigan Junior
0 siblings, 0 replies; only message in thread
From: Sergio Durigan Junior @ 2019-08-26 13:19 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d9c4ba536c522b8dc2194d4100270a159be7894a
commit d9c4ba536c522b8dc2194d4100270a159be7894a
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Sun Aug 25 12:10:35 2019 -0400
Use raw strings on gdb.python/py-xmethods.exp (and fix Python 3.8's "SyntaxWarning: invalid escape sequence")
The way unrecognized escape sequences are handled has changed in
Python 3.8: users now see a SyntaxWarning message, which will
eventually become a SyntaxError in future versions of Python:
(gdb) source /blabla/gdb.python/py-xmethods/py-xmethods.py
/blabla/gdb.python/py-xmethods/py-xmethods.py:204: SyntaxWarning: invalid escape seque
nce \+
'operator\+',
/blabla/gdb.python/py-xmethods/py-xmethods.py:211: SyntaxWarning: invalid escape seque
nce \+
'operator\+\+',
One of our testcases, gdb.python/py-xmethods.exp, contains strings in
the form of "operator\+". This is not recognized by Python, but is
still needed by the testsuite to work properly. The solution is
simple: we just have to make sure these strings are marked as
raw (i.e, r""). This is what this patch does. I took the opportunity
to also convert other strings to raw, which, in two cases, allowed the
removal of an extra backslash.
I tested this using Python 3.7 and Python 3.8, and everything works
fine.
I think I could push this as obvious, but decided to send it to
gdb-patches just in case.
gdb/testsuite/ChangeLog:
2019-08-26 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.python/py-xmethods.exp: Use raw strings when passing
arguments to SimpleXMethodMatcher.
Diff:
---
gdb/testsuite/ChangeLog | 5 +++++
gdb/testsuite/gdb.python/py-xmethods.py | 36 ++++++++++++++++-----------------
2 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 639bea2..e8445f8 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-08-26 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * gdb.python/py-xmethods.exp: Use raw strings when passing
+ arguments to SimpleXMethodMatcher.
+
2019-08-22 Tom de Vries <tdevries@suse.de>
* gdb.multi/multi-term-settings.exp (coretest): Make gdb_test messages
diff --git a/gdb/testsuite/gdb.python/py-xmethods.py b/gdb/testsuite/gdb.python/py-xmethods.py
index 587842d..cea48b8 100644
--- a/gdb/testsuite/gdb.python/py-xmethods.py
+++ b/gdb/testsuite/gdb.python/py-xmethods.py
@@ -199,34 +199,34 @@ class G_methods_matcher(XMethodMatcher):
global_dm_list = [
- SimpleXMethodMatcher('A_plus_A',
- '^dop::A$',
- 'operator\+',
+ SimpleXMethodMatcher(r'A_plus_A',
+ r'^dop::A$',
+ r'operator\+',
A_plus_A,
# This is a replacement, hence match the arg type
# exactly!
type_A.const().reference()),
- SimpleXMethodMatcher('plus_plus_A',
- '^dop::A$',
- 'operator\+\+',
+ SimpleXMethodMatcher(r'plus_plus_A',
+ r'^dop::A$',
+ r'operator\+\+',
plus_plus_A),
- SimpleXMethodMatcher('A_geta',
- '^dop::A$',
- '^geta$',
+ SimpleXMethodMatcher(r'A_geta',
+ r'^dop::A$',
+ r'^geta$',
A_geta),
- SimpleXMethodMatcher('A_getarrayind',
- '^dop::A$',
- '^getarrayind$',
+ SimpleXMethodMatcher(r'A_getarrayind',
+ r'^dop::A$',
+ r'^getarrayind$',
A_getarrayind,
type_int),
- SimpleXMethodMatcher('A_indexoper',
- '^dop::A$',
- 'operator\\[\\]',
+ SimpleXMethodMatcher(r'A_indexoper',
+ r'^dop::A$',
+ r'operator\[\]',
A_indexoper,
type_int),
- SimpleXMethodMatcher('B_indexoper',
- '^dop::B$',
- 'operator\\[\\]',
+ SimpleXMethodMatcher(r'B_indexoper',
+ r'^dop::B$',
+ r'operator\[\]',
B_indexoper,
type_int)
]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-08-26 13:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-26 13:19 [binutils-gdb] Use raw strings on gdb.python/py-xmethods.exp (and fix Python 3.8's "SyntaxWarning: invalid escape s Sergio Durigan Junior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).