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

Invalid escape sequence warning with Python 3.12 #100

Closed
SoMuchForSubtlety opened this issue Nov 22, 2023 · 1 comment
Closed

Invalid escape sequence warning with Python 3.12 #100

SoMuchForSubtlety opened this issue Nov 22, 2023 · 1 comment

Comments

@SoMuchForSubtlety
Copy link

SoMuchForSubtlety commented Nov 22, 2023

Running diceware with python 3.12 results in the following warnings

/usr/lib/python3.12/site-packages/diceware/wordlist.py:32: SyntaxWarning: invalid escape sequence '\w'
  RE_WORDLIST_NAME = re.compile('^[\w-]+$')
/usr/lib/python3.12/site-packages/diceware/wordlist.py:35: SyntaxWarning: invalid escape sequence '\-'
  RE_NUMBERED_WORDLIST_ENTRY = re.compile('^[0-9]+(\-[0-9]+)*\s+([^\s]+)$')
/usr/lib/python3.12/site-packages/diceware/wordlist.py:39: SyntaxWarning: invalid escape sequence '\w'
  '^wordlist_([\w-]+)\.[\w][\w\.]+[\w]+$')

From the python 3.12 release notes1:

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 gh-98401.)

Footnotes

  1. https://docs.python.org/3/whatsnew/3.12.html#other-language-changes

@SoMuchForSubtlety
Copy link
Author

Looks like this was fixed in c1aa7b1

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

1 participant