about summary refs log tree commit diff
path: root/pkgs/games/anki/python-3.7-compat.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/games/anki/python-3.7-compat.patch')
-rw-r--r--pkgs/games/anki/python-3.7-compat.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkgs/games/anki/python-3.7-compat.patch b/pkgs/games/anki/python-3.7-compat.patch
new file mode 100644
index 0000000000000..8545b39d08cb2
--- /dev/null
+++ b/pkgs/games/anki/python-3.7-compat.patch
@@ -0,0 +1,23 @@
+commit 3d69aa9ce454a151ba75deafd7de117af2c7307d
+Author: Alexey Lebedeff <binarin@binarin.ru>
+Date:   Fri Nov 30 10:44:39 2018 +0100
+
+    Fix searching for python 3.7
+    
+    3.7 introduced a change to `re.escape()`, which no longer escapes
+    `%`. By using `re.escape("%")` instead of a literal, we can detect
+    a proper form at runtime.
+
+diff --git a/anki/find.py b/anki/find.py
+index 48d0dd1..213216d 100644
+--- a/anki/find.py
++++ b/anki/find.py
+@@ -440,7 +440,7 @@ select distinct(n.id) from cards c, notes n where c.nid=n.id and """+preds
+             # nothing has that field
+             return
+         # gather nids
+-        regex = re.escape(val).replace("_", ".").replace("\\%", ".*")
++        regex = re.escape(val).replace("_", ".").replace(re.escape('%'), ".*")
+         nids = []
+         for (id,mid,flds) in self.col.db.execute("""
+ select id, mid, flds from notes