* [PATCH] comedi: ni_routing: fix SyntaxWarning in convert_csv_to_c.py
@ 2026-11-18 5:09 desobei
2026-11-18 6:49 ` Greg Kroah-Hartman
0 siblings, 1 reply; 2+ messages in thread
From: desobei @ 2026-11-18 5:09 UTC (permalink / raw)
To: Ian Abbott, H Hartley Sweeten; +Cc: Greg Kroah-Hartman, linux-kernel, desobei
convert_csv_to_c.py validates register values against the regex
'[VIU]\([^)]*\)', written as a plain string literal. "\(" and "\)" are
not valid Python escape sequences, so with Python 3.12 and later every
run of the script (e.g. "make c-files") prints:
convert_csv_to_c.py:47: SyntaxWarning: "\(" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\("? A raw string is also an option.
Python currently keeps unrecognized escapes verbatim, so the regex still
works, but the script will stop compiling once this warning becomes an
error.
Use a raw string. The resulting string is identical, so there is no
functional change.
The problem was found by compiling all in-tree Python files with Python
3.14 and SyntaxWarning promoted to an error. The search and this patch
were done with the help of an AI coding assistant (Claude Opus 5.5).
Tested by checking that the script now compiles cleanly with warnings
as errors, that its compiled bytecode, constants and names are
unchanged, and that the regex still accepts all 95 register values used
in the ni_route_values tables.
Signed-off-by: desobei <desobei@outlook.com>
---
drivers/comedi/drivers/ni_routing/tools/convert_csv_to_c.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/comedi/drivers/ni_routing/tools/convert_csv_to_c.py b/drivers/comedi/drivers/ni_routing/tools/convert_csv_to_c.py
index 90378fb50580..d19101fc2a94 100755
--- a/drivers/comedi/drivers/ni_routing/tools/convert_csv_to_c.py
+++ b/drivers/comedi/drivers/ni_routing/tools/convert_csv_to_c.py
@@ -44,7 +44,7 @@ def routedict_to_structinit_single(name, D, return_name=False):
lines.append('\t\t[B({})] = {{'.format(D0_sig))
for D1_sig, value in D1:
- if not re.match('[VIU]\([^)]*\)', value):
+ if not re.match(r'[VIU]\([^)]*\)', value):
sys.stderr.write('Invalid register format: {}\n'.format(repr(value)))
sys.stderr.write(
'Register values should be formatted with V(),I(),or U()\n')
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] comedi: ni_routing: fix SyntaxWarning in convert_csv_to_c.py
2026-11-18 5:09 [PATCH] comedi: ni_routing: fix SyntaxWarning in convert_csv_to_c.py desobei
@ 2026-11-18 6:49 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-18 6:49 UTC (permalink / raw)
To: desobei; +Cc: Ian Abbott, H Hartley Sweeten, linux-kernel
On Wed, Nov 18, 2026 at 12:09:49AM -0500, desobei wrote:
> convert_csv_to_c.py validates register values against the regex
> '[VIU]\([^)]*\)', written as a plain string literal. "\(" and "\)" are
> not valid Python escape sequences, so with Python 3.12 and later every
> run of the script (e.g. "make c-files") prints:
>
> convert_csv_to_c.py:47: SyntaxWarning: "\(" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\("? A raw string is also an option.
>
> Python currently keeps unrecognized escapes verbatim, so the regex still
> works, but the script will stop compiling once this warning becomes an
> error.
>
> Use a raw string. The resulting string is identical, so there is no
> functional change.
>
> The problem was found by compiling all in-tree Python files with Python
> 3.14 and SyntaxWarning promoted to an error. The search and this patch
> were done with the help of an AI coding assistant (Claude Opus 5.5).
> Tested by checking that the script now compiles cleanly with warnings
> as errors, that its compiled bytecode, constants and names are
> unchanged, and that the regex still accepts all 95 register values used
> in the ni_route_values tables.
>
> Signed-off-by: desobei <desobei@outlook.com>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- It looks like you did not use your "real" name for the patch on either
the Signed-off-by: line, or the From: line (both of which have to
match). Please read the kernel file,
Documentation/process/submitting-patches.rst for how to do this
correctly.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-18 6:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 5:09 [PATCH] comedi: ni_routing: fix SyntaxWarning in convert_csv_to_c.py desobei
2026-11-18 6:49 ` Greg Kroah-Hartman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.