Skip to content

Commit

Permalink
Fix escape sequence for Python 3.12
Browse files Browse the repository at this point in the history
A backslash-character pair that is not a valid escape sequence now generates a
SyntaxWarning. It outputs to stderr which makes the tests to fail.

See python/cpython#98401 .

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1061803
  • Loading branch information
changwoo committed Feb 11, 2024
1 parent 07c3392 commit 6061642
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion data/scripts/import-opendict.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def xml_workaround(self, s):

def sanitize_word(self, word):
word = word[:1] + word[1:].replace('-','').replace('^','')
m = re.match('^([^0-9]+)[0-9]*', word)
m = re.match(r'^([^0-9]+)[0-9]*', word)
return m.group(1)

def yaml_cache_find_yaml_doc(self, opendict_id, word, pos):
Expand Down
2 changes: 1 addition & 1 deletion data/scripts/import-stdict.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def xml_workaround(self, s):

def sanitize_word(self, word):
word = word[:1] + word[1:].replace('-','').replace('^','')
m = re.match('^([^0-9]+)[0-9]*', word)
m = re.match(r'^([^0-9]+)[0-9]*', word)
return m.group(1)

def yaml_cache_find_yaml_doc(self, stdict_id, word, pos):
Expand Down
2 changes: 1 addition & 1 deletion tests/checkhunspellversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def main():
first_line = hunspell.stdout.readline().decode('UTF-8')
hunspell.kill()

m = re.match('^.*Hunspell ([0-9\.]+).$', first_line)
m = re.match(r'^.*Hunspell ([0-9\.]+).$', first_line)
numbers = [int(s) for s in m.group(1).split('.')]
if len(numbers) >= 3:
if check_version(numbers, [1, 6, 2]):
Expand Down

0 comments on commit 6061642

Please sign in to comment.