Skip to content

Commit

Permalink
Merge pull request #1188 from user202729/fix-leak-suggestions
Browse files Browse the repository at this point in the history
Fix unbounded memory use caused by defaultdict access in suggestions feature
  • Loading branch information
benoit-pierre authored Apr 1, 2021
2 parents 1a667b1 + b7b0aee commit 5f236ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions news.d/bugfix/1188.core.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix unbounded memory use in the lookup functions used by the Suggestions window.
4 changes: 2 additions & 2 deletions plover/steno_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ def __contains__(self, key):
return self.get(key) is not None

def reverse_lookup(self, value):
return set(self.reverse[value])
return set(self.reverse.get(value, ()))

def casereverse_lookup(self, value):
return set(self.casereverse[value])
return set(self.casereverse.get(value, ()))

@property
def _longest_key(self):
Expand Down

0 comments on commit 5f236ba

Please sign in to comment.