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

pytest-profiling: Invalid Escape Sequence Causes SyntaxWarning in Python 3.12 #238

Closed
PeterParker opened this issue Sep 17, 2024 · 6 comments

Comments

@PeterParker
Copy link

I'm seeing the following warning in Python 3.12, which does not like the \: escape sequence:

/usr/local/sis/.venv/lib/python3.12/site-packages/pytest_profiling.py:20: SyntaxWarning: invalid escape sequence '\:'
  forbidden_chars = set('/?<>\:*|"')
@PeterParker PeterParker changed the title Invalid Escape Sequence Causes SyntaxWarning in Python 3.12 pytest-profiling: Invalid Escape Sequence Causes SyntaxWarning in Python 3.12 Sep 17, 2024
@PeterParker
Copy link
Author

PeterParker commented Sep 17, 2024

I believe changing the quoted line to the following will fix the warning:

forbidden_chars = set('/?<>\\:*|"')

I.e., the backslash needs to be escaped with a backslash.

Or, use a raw string literal:

forbidden_chars = set(r'/?<>\:*|"')

@ckcollab
Copy link

@offbyone
Copy link

It was fixed in code in 2020, but the last release was in 2019.

offbyone added a commit to WorldconVotingSystems/nomnom that referenced this issue Sep 23, 2024
@jonbannister
Copy link
Contributor

This has been released as part of 1.8.0, please raise another issue if this persists!

@offbyone
Copy link

Enabling this with Python 3.12 and pytest 8 leads to this failure:

https://github.com/WorldconVotingSystems/nomnom/actions/runs/11388699099/job/31686308429?pr=186#step:8:72

@jonbannister
Copy link
Contributor

Thanks @offbyone , looks like a different error. We'll address in #229

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

No branches or pull requests

4 participants