[PATCH] patman: Resolve python string vs. regex escaping syntax

Simon Glass sjg at chromium.org
Sun Jul 28 21:36:02 CEST 2024


On Fri, 26 Jul 2024 at 13:03, Brian Norris <computersforpeace at gmail.com> wrote:
>
> Python strings have their own notion of backslash-escaping, and that can
> conflict with the intentions for strings passed to the 're' module. In
> particular, I get warnings like this:
>
> tools/patman/../patman/commit.py:9: SyntaxWarning: invalid escape sequence '\s'
>   re_subject_tag = re.compile('([^:\s]*):\s*(.*)')
>
> We should use a raw string (r'...') so that all escaping is passed into
> the regex module, not interpreted within the string itself.
>
> Signed-off-by: Brian Norris <computersforpeace at gmail.com>
> ---
>
>  tools/patman/commit.py      | 2 +-
>  tools/patman/patchstream.py | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list