8000 Merge pull request #3446 from jepler/python35-compression-fix · kdb424/circuitpython@df067b4 · GitHub
[go: up one dir, main page]

Skip to content

Commit df067b4

Browse files
authored
Merge pull request adafruit#3446 from jepler/python35-compression-fix
makeqstrdata: Work around python3.5/3.6 compatibility problem
8000
2 parents c963771 + 0318eb3 commit df067b4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

py/makeqstrdata.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ class TextSplitter:
109109
def __init__(self, words):
110110
words.sort(key=lambda x: len(x), reverse=True)
111111
self.words = set(words)
112-
self.pat = re.compile("|".join(re.escape(w) for w in words) + "|.", flags=re.DOTALL)
112+
if words:
113+
pat = "|".join(re.escape(w) for w in words) + "|."
114+
else:
115+
pat = "."
116+
self.pat = re.compile(pat, flags=re.DOTALL)
113117

114118
def iter_words(self, text):
115119
s = []

0 commit comments

Comments
 (0)
0