Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asan_symbolize.py: SyntaxWarning reported by Python 3.12 re. invalid escape sequences #97815

Open
moha-gh opened this issue Jul 5, 2024 · 0 comments
Labels
compiler-rt:asan Address sanitizer

Comments

@moha-gh
Copy link

moha-gh commented Jul 5, 2024

When using compiler-rt/lib/asan/scripts/asan_symbolize.py with Python 3.12, two syntax warnings concerning invalid escape sequences are being reported:

[...]/asan_symbolize.py:319: SyntaxWarning: invalid escape sequence '\('
  match = re.match("^(.*) \(in (.*)\) \((.*:\d*)\)$", atos_line)
[...]/asan_symbolize.py:544: SyntaxWarning: invalid escape sequence '\('
  "^( *#([0-9]+) *)(0x[0-9a-f]+) *(?:in *.+)? *\((.*)\+(0x[0-9a-f]+)\)

This is caused by a change in behaviour in Python 3.12 to eventually make such things syntax errors (see release notes).

I'd be happy to file a PR to fix this, but I'm not sure how the regexes are supposed to look / why the invalid escape sequences have been added in the first place.

@EugeneZelenko EugeneZelenko added compiler-rt:asan Address sanitizer and removed new issue labels Jul 5, 2024
negril added a commit to negril/llvm-project that referenced this issue Aug 25, 2024
Changed in python version 3.12:
  A backslash-character pair that is not a valid escape sequence now generates a
  SyntaxWarning, instead of DeprecationWarning. For example, re.compile("\d+\.
  \d+") now emits a SyntaxWarning ("\d" is an invalid escape sequence, use raw
  strings for regular expression: re.compile(r"\d+\.\d+")). In a future Python
  version, SyntaxError will eventually be raised, instead of SyntaxWarning.
  (Contributed by Victor Stinner in llvmgh-98401.)

Closes: llvm#97815
See-also: https://docs.python.org/3/reference/lexical_analysis.html#escape-sequences
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler-rt:asan Address sanitizer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants