ulif / diceware

Passphrases to remember
GNU General Public License v3.0
354 stars 45 forks source link

Invalid escape sequence warning with Python 3.12 #100

Closed SoMuchForSubtlety closed 9 months ago

SoMuchForSubtlety commented 9 months ago

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 notes^1:

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

SoMuchForSubtlety commented 9 months ago

Looks like this was fixed in c1aa7b1e5bd1ee81734462d1d3a3e5f9b724a263