public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2] test_printers_common.py: Remove invalid escape sequence
@ 2024-02-12 14:06 H.J. Lu
  2024-02-12 14:14 ` Florian Weimer
  2024-02-12 17:55 ` Joseph Myers
  0 siblings, 2 replies; 3+ messages in thread
From: H.J. Lu @ 2024-02-12 14:06 UTC (permalink / raw)
  To: libc-alpha

Change "\(" and "\)" to "\\(" and "\\)" in test_printers_common.py.  This
fixes the test warning:

.../scripts/test_printers_common.py:101: SyntaxWarning: invalid escape sequence '\('
---
 scripts/test_printers_common.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/test_printers_common.py b/scripts/test_printers_common.py
index bf700966ac..5c0d936fed 100644
--- a/scripts/test_printers_common.py
+++ b/scripts/test_printers_common.py
@@ -98,7 +98,7 @@ try:
     # If everything's ok, spawn the gdb process we'll use for testing.
     gdb = pexpect.spawn(gdb_invocation, echo=False, timeout=timeout,
                         encoding=encoding)
-    gdb_prompt = u'\(gdb\)'
+    gdb_prompt = u'\\(gdb\\)'
     gdb.expect(gdb_prompt)
 
 except pexpect.ExceptionPexpect as exception:
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] test_printers_common.py: Remove invalid escape sequence
  2024-02-12 14:06 [PATCH v2] test_printers_common.py: Remove invalid escape sequence H.J. Lu
@ 2024-02-12 14:14 ` Florian Weimer
  2024-02-12 17:55 ` Joseph Myers
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Weimer @ 2024-02-12 14:14 UTC (permalink / raw)
  To: H.J. Lu; +Cc: libc-alpha

* H. J. Lu:

> Change "\(" and "\)" to "\\(" and "\\)" in test_printers_common.py.  This
> fixes the test warning:
>
> .../scripts/test_printers_common.py:101: SyntaxWarning: invalid escape sequence '\('
> ---
>  scripts/test_printers_common.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/test_printers_common.py b/scripts/test_printers_common.py
> index bf700966ac..5c0d936fed 100644
> --- a/scripts/test_printers_common.py
> +++ b/scripts/test_printers_common.py
> @@ -98,7 +98,7 @@ try:
>      # If everything's ok, spawn the gdb process we'll use for testing.
>      gdb = pexpect.spawn(gdb_invocation, echo=False, timeout=timeout,
>                          encoding=encoding)
> -    gdb_prompt = u'\(gdb\)'
> +    gdb_prompt = u'\\(gdb\\)'
>      gdb.expect(gdb_prompt)
>  
>  except pexpect.ExceptionPexpect as exception:

This version looks okay to me.

Reviewed-by: Florian Weimer <fweimer@redhat.com>

Thanks,
Florian


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] test_printers_common.py: Remove invalid escape sequence
  2024-02-12 14:06 [PATCH v2] test_printers_common.py: Remove invalid escape sequence H.J. Lu
  2024-02-12 14:14 ` Florian Weimer
@ 2024-02-12 17:55 ` Joseph Myers
  1 sibling, 0 replies; 3+ messages in thread
From: Joseph Myers @ 2024-02-12 17:55 UTC (permalink / raw)
  To: H.J. Lu; +Cc: libc-alpha

On Mon, 12 Feb 2024, H.J. Lu wrote:

> -    gdb_prompt = u'\(gdb\)'
> +    gdb_prompt = u'\\(gdb\\)'

It's generally better to use r'' strings to avoid needing to double 
backslashes.  And u'' is obsolete in Python 3 (and our scripts don't 
support Python 2 any more) so should not be used.

-- 
Joseph S. Myers
josmyers@redhat.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-12 17:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12 14:06 [PATCH v2] test_printers_common.py: Remove invalid escape sequence H.J. Lu
2024-02-12 14:14 ` Florian Weimer
2024-02-12 17:55 ` Joseph Myers

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).