Skip to content

Commit

Permalink
Properly set CharsetGroupProber.state to FOUND_IT
Browse files Browse the repository at this point in the history
Throughout the rest of the chardet code we assume that FOUND_IT means we
can stop looking. Previously the CharsetGroupProber did not set its
state appropriately when a child prober returned FOUND_IT. This
substantially speeds up the chardet for most encodings.

Fixes #202
  • Loading branch information
dan-blanchard committed Dec 10, 2020
1 parent 1db0347 commit 3c4202a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions chardet/charsetgroupprober.py
Expand Up @@ -73,6 +73,7 @@ def feed(self, byte_str):
continue
if state == ProbingState.FOUND_IT:
self._best_guess_prober = prober
self._state = ProbingState.FOUND_IT
return self.state
elif state == ProbingState.NOT_ME:
prober.active = False
Expand Down

0 comments on commit 3c4202a

Please sign in to comment.