Skip to content

Commit

Permalink
feat(checks): release GIL during matching
Browse files Browse the repository at this point in the history
The regex module supports this so let's use it as it can allow other
threads to run while matchin on long strings.
  • Loading branch information
nijel committed Feb 13, 2025
1 parent 35c814c commit d392f85
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions weblate/checks/placeholders.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get_value(self, unit: Unit):

@staticmethod
def get_matches(value, text: str):
for match in value.finditer(text):
for match in value.finditer(text, concurrent=True):
yield match.group()

def diff_case_sensitive(self, expected, found):
Expand Down Expand Up @@ -159,7 +159,7 @@ def check_highlight(self, source: str, unit: Unit):

regex = self.get_value(unit)

for match in regex.finditer(source):
for match in regex.finditer(source, concurrent=True):
yield (match.start(), match.end(), match.group())

def get_description(self, check_obj):
Expand Down

0 comments on commit d392f85

Please sign in to comment.