From 5f34fac7e3ef42284aaa9d2ab8b244c481d59753 Mon Sep 17 00:00:00 2001 From: Motoki Naruse Date: Sun, 11 Jun 2017 15:38:59 +0900 Subject: [PATCH] bpo-30629: Fix call lower() twice https://bugs.python.org/issue30629 https://github.com/python/cpython/blob/master/Lib/html/parser.py#L415 ``` elem = match.group(1).lower() # script or style if self.cdata_elem is not None: if elem != self.cdata_elem: self.handle_data(rawdata[i:gtpos]) return gtpos self.handle_endtag(elem.lower()) ``` elem is lowercase string because lower() is called at the first line. So the last line of calling lower() is unnecessary. --- Lib/html/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/html/parser.py b/Lib/html/parser.py index ef869bc72db780..de81879a631ac7 100644 --- a/Lib/html/parser.py +++ b/Lib/html/parser.py @@ -418,7 +418,7 @@ def parse_endtag(self, i): self.handle_data(rawdata[i:gtpos]) return gtpos - self.handle_endtag(elem.lower()) + self.handle_endtag(elem) self.clear_cdata_mode() return gtpos