[clang] [compiler-rt] [libcxx] [lld] [lldb] [llvm] [mlir] [polly] python: use raw strings for regex (PR #105990)
Sam James via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 26 09:43:05 PDT 2024
================
@@ -284,7 +284,7 @@ def sync_csv(rows: List[Tuple], from_github: List[PaperInfo]) -> List[Tuple]:
results.append(gh.for_printing())
continue
elif paper.status != gh.status:
- print(f"We found a CSV row and a Github issue with different statuses:\nrow: {row}\Github issue: {gh}")
+ print(rf"We found a CSV row and a Github issue with different statuses:\nrow: {row}\Github issue: {gh}")
----------------
thesamesam wrote:
I believe @negril is right.
Note that https://docs.python.org/3/whatsnew/3.12.html#other-language-changes doesn't say it's exclusive to regex:
> A backslash-character pair that is not a valid escape sequence now generates a [SyntaxWarning](https://docs.python.org/3/library/exceptions.html#SyntaxWarning), instead of [DeprecationWarning](https://docs.python.org/3/library/exceptions.html#DeprecationWarning). For example, re.compile("\d+\.\d+") now emits a [SyntaxWarning](https://docs.python.org/3/library/exceptions.html#SyntaxWarning) ("\d" is an invalid escape sequence, use raw strings for regular expression: re.compile(r"\d+\.\d+")). In a future Python version, [SyntaxError](https://docs.python.org/3/library/exceptions.html#SyntaxError) will eventually be raised, instead of [SyntaxWarning](https://docs.python.org/3/library/exceptions.html#SyntaxWarning). (Contributed by Victor Stinner in [gh-98401](https://github.com/python/cpython/issues/98401).)
https://github.com/llvm/llvm-project/pull/105990
More information about the cfe-commits
mailing list