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

SyntaxWarning from gen_compile_commands.py #6896

Closed
LuminousXLB opened this issue Jun 18, 2024 · 2 comments · Fixed by #6897
Closed

SyntaxWarning from gen_compile_commands.py #6896

LuminousXLB opened this issue Jun 18, 2024 · 2 comments · Fixed by #6897

Comments

@LuminousXLB
Copy link
Contributor

I see there's noqa: W605 to suppress the complaint "Invalid escape sequence" from linter, but this is becoming a SyntaxWarning from Python 3.12 (ref).

# The .cmd files are intended to be included directly by Make, so they
# escape the pound sign '#', either as '\#' or '$(pound)' (depending on the
# kernel version). The compile_commands.json file is not interpreted
# by Make, so this code replaces the escaped version with '#'.
prefix = command_prefix.replace('\#', '#').replace('$(pound)', '#') # noqa: W605

I'd propose we properly escape the back slash by changing it to

command_prefix.replace(r'\#', '#')
@jforissier
Copy link
Contributor

Hi @LuminousXLB, your are probably right. Would you mind creating a pull request?

@LuminousXLB
Copy link
Contributor Author

Yes @jforissier , I've opened a PR on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants