classification
Title: lower() is called twice
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: motoki, terry.reedy
Priority: normal Keywords:

Created on 2017-06-11 06:36 by motoki, last changed 2017-06-20 08:29 by terry.reedy. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 2099 merged python-dev, 2017-06-11 06:44
PR 2284 merged motoki, 2017-06-20 04:17
Messages (6)
msg295689 - (view) Author: 成瀬基樹 (motoki) * Date: 2017-06-11 06:36
https://github.com/python/cpython/blob/master/Lib/html/parser.py#L415

elem is already lowercase string but call lower() for handle_endtag().

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())
msg296222 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-17 01:15
New changeset 3358d589fb51372a56ddcfffa277855e5661c4c0 by terryjreedy (Motoki Naruse) in branch 'master':
bpo-30629: Remove second call of str.lower() in html.parser.parse_endtag. (#2099)
https://github.com/python/cpython/commit/3358d589fb51372a56ddcfffa277855e5661c4c0
msg296223 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-17 01:25
This appears to be your first CPython contribution.  Welcome.  We hope it is not the last.  If you prepare a PR to add yourself to Misc/ACKS, in appropriate alphabetical position, I will merge it.  Just suggest me as a reviewer.
msg296398 - (view) Author: 成瀬基樹 (motoki) * Date: 2017-06-20 04:10
It will be highlight of my programmer life. Thank you. That pull request is just the beginning, not the last.
msg296406 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-20 08:10
New changeset 5cc7ac24da10568d2a910a91a24183b904118cf8 by terryjreedy (Motoki Naruse) in branch 'master':
bpo-30629: Add Motoki Naruse to Misc/ACKS (#2284)
https://github.com/python/cpython/commit/5cc7ac24da10568d2a910a91a24183b904118cf8
msg296407 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-20 08:29
What persuaded me to make the offer was your extra effort to include the link to the specific line and the minimal quote needed to explain.  The link made it trivial to look at the context of the change.
History
Date User Action Args
2017-06-20 08:29:31terry.reedysetstatus: open -> closed
assignee: terry.reedy
messages: + msg296407
2017-06-20 08:10:15terry.reedysetmessages: + msg296406
2017-06-20 04:18:00motokisetpull_requests: + pull_request2332
2017-06-20 04:10:24motokisetmessages: + msg296398
2017-06-17 01:25:28terry.reedysettype: enhancement
resolution: fixed
messages: + msg296223
stage: resolved
2017-06-17 01:15:27terry.reedysetnosy: + terry.reedy
messages: + msg296222
2017-06-11 06:44:06python-devsetpull_requests: + pull_request2155
2017-06-11 06:36:19motokicreate