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

Fix invalid escape sequence warning in Python 3.12 #1420

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

oshiteku
Copy link
Contributor

When importing bitsandbytes for the first time in Python 3.12, the following warning is displayed:

$ python -c 'import bitsandbytes'
/home/oshiteku/tmp/.venv/lib/python3.12/site-packages/bitsandbytes/cextension.py:48: SyntaxWarning: invalid escape sequence '\d'
  library_name = re.sub("cuda\d+", f"cuda{override_value}", library_name, count=1)

Changes:

  • Fix invalid escape sequence in regex pattern
  • Add linter configuration to check for invalid escape sequences

Copy link

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@matthewdouglas
Copy link
Member

Thanks! I don't see the warning show up on my environment (Python 3.12.7, Arch Linux) but this change is sensible.

@matthewdouglas matthewdouglas added bug Something isn't working Low Risk Risk of bugs in transformers and other libraries labels Nov 19, 2024
@matthewdouglas matthewdouglas merged commit 31eeb60 into bitsandbytes-foundation:main Nov 19, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Low Risk Risk of bugs in transformers and other libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants