From 3c4202ac716a19f8ecb8585ea94e11d23846df7f Mon Sep 17 00:00:00 2001 From: Dan Blanchard Date: Thu, 10 Dec 2020 10:47:13 -0500 Subject: [PATCH] Properly set CharsetGroupProber.state to FOUND_IT 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 --- chardet/charsetgroupprober.py | 1 + 1 file changed, 1 insertion(+) diff --git a/chardet/charsetgroupprober.py b/chardet/charsetgroupprober.py index 8b3738ef..5812cef0 100644 --- a/chardet/charsetgroupprober.py +++ b/chardet/charsetgroupprober.py @@ -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