[llvm] github-automation.py: Use raw strings for regex (PR #184326)

Kleis Auke Wolthuizen via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 03:24:26 PST 2026


https://github.com/kleisauke created https://github.com/llvm/llvm-project/pull/184326

Avoids a `SyntaxWarning: invalid escape sequence`.

As noticed in:
https://github.com/llvm/llvm-project/actions/runs/22620420192/job/65543770329
https://github.com/llvm/llvm-project/actions/runs/22607027706/job/65501262987

>From 9d15f3d5994c1fd2ac26c8055579edc14c458c93 Mon Sep 17 00:00:00 2001
From: Kleis Auke Wolthuizen <github at kleisauke.nl>
Date: Tue, 3 Mar 2026 12:22:24 +0100
Subject: [PATCH] github-automation.py: Use raw strings for regex

Avoids a `SyntaxWarning: invalid escape sequence`.
---
 llvm/utils/git/github-automation.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py
index 2f4f805023bad..07cb6684a7b89 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -54,9 +54,9 @@ def escape_description(str):
     # https://github.com/github/markup/issues/1168#issuecomment-494946168
     str = html.escape(str, False)
     # '@' followed by alphanum is a user name
-    str = re.sub("@(?=\w)", "@<!-- -->", str)
+    str = re.sub(r"@(?=\w)", "@<!-- -->", str)
     # '#' followed by digits is considered an issue number
-    str = re.sub("#(?=\d)", "#<!-- -->", str)
+    str = re.sub(r"#(?=\d)", "#<!-- -->", str)
     return str
 
 
@@ -650,7 +650,7 @@ def issue_remove_cherry_pick_failed_label(self):
     def get_main_commit(self, cherry_pick_sha: str) -> github.Commit.Commit:
         commit = self.repo.get_commit(cherry_pick_sha)
         message = commit.commit.message
-        m = re.search("\(cherry picked from commit ([0-9a-f]+)\)", message)
+        m = re.search(r"\(cherry picked from commit ([0-9a-f]+)\)", message)
         if not m:
             return None
         return self.repo.get_commit(m.group(1))



More information about the llvm-commits mailing list