Skip to content
New issue

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

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

Already on GitHub? # to your account

fix SyntaxWarning #548

Merged
merged 1 commit into from
Oct 22, 2024
Merged

Conversation

abcdabcd987
Copy link
Member

Python 3.12 raises SyntaxWarning for invalid escape sequence like "\d".

This PR: Use raw strings for the regex and also add a capture group.

Python 3.12.7 | packaged by conda-forge | (main, Oct  4 2024, 16:05:46) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> import re
>>> cuda_arch_flags = '-gencode=arch=compute_90,code=compute_90'

>>> int(re.search("compute_\d+", cuda_arch_flags).group()[-2:])
<stdin>:1: SyntaxWarning: invalid escape sequence '\d'
90

>>> int(re.search(r"compute_(\d+)", cuda_arch_flags).group(1))
90

@zhyncs zhyncs merged commit 47583b3 into flashinfer-ai:main Oct 22, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants