GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — HTMLParser: undocumented not implemented method · Issue #76025 · python/cpython

HTMLParser: undocumented not implemented method #76025

New issue
Copy link
New issue
Copy link
Closed
Closed
HTMLParser: undocumented not implemented method#76025
Copy link
Assignees
ezio-melotti
Labels
3.10 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

srittau
mannequin
opened on Oct 23, 2017
Issue body actions
BPO 31844
Nosy @srittau, @ezio-melotti, @berkerpeksag, @csabella
PRs
  • bpo-31844: Remove _markupbase.ParserBase.error() #8562
  • bpo-31844: Move whatsnew note to 3.10.rst #21504
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ezio-melotti'
    closed_at = <Date 2020-07-16.06:39:25.857>
    created_at = <Date 2017-10-23.08:27:23.318>
    labels = ['type-bug', 'library', '3.10']
    title = 'HTMLParser: undocumented not implemented method'
    updated_at = <Date 2020-07-16.06:39:25.857>
    user = 'https://github.com/srittau'

    bugs.python.org fields:

    activity = <Date 2020-07-16.06:39:25.857>
    actor = 'berker.peksag'
    assignee = 'ezio.melotti'
    closed = True
    closed_date = <Date 2020-07-16.06:39:25.857>
    closer = 'berker.peksag'
    components = ['Library (Lib)']
    creation = <Date 2017-10-23.08:27:23.318>
    creator = 'srittau'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31844
    keywords = ['patch']
    message_count = 10.0
    messages = ['304782', '304783', '305303', '305306', '322662', '322672', '323968', '371500', '373745', '373746']
    nosy_count = 5.0
    nosy_names = ['srittau', 'ezio.melotti', 'berker.peksag', 'cheryl.sabella', 'William Ayd']
    pr_nums = ['8562', '21504']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue31844'
    versions = ['Python 3.10']

    Activity

    1. srittau commented on Oct 23, 2017

      @srittau
      srittaumannequin
      on Oct 23, 2017
      MannequinAuthor
      More actions

      HTMLParser derives from _markupbase.ParserBase, which has the following method:

      class HTMLParser:
      ...
      
          def error(self, message):
              raise NotImplementedError(
                  "subclasses of ParserBase must override error()")

      HTMLParser does not implement this method and the documentation for HTMLParser (https://docs.python.org/3.6/library/html.parser.html) does not mention that its sub-classes need to override it.

      I am not sure whether this is a documentation omission, whether HTMLParser should provide an (empty?) implementation, or whether ParserBase should not raise a NotImplementedError (to make linters happy).

    2. srittau commented on Oct 23, 2017

      @srittau
      srittaumannequin
      on Oct 23, 2017
      MannequinAuthor
      More actions

      The quoted code above should have used ParserBase:

      class ParserBase:
      ...
      
          def error(self, message):
              raise NotImplementedError(
                  "subclasses of ParserBase must override error()")
    3. WilliamAyd commented on Oct 31, 2017

      @WilliamAyd
      WilliamAydmannequin
      on Oct 31, 2017
      Mannequin
      More actions

      Would we be open to setting the meta class of the ParserBase to ABCMeta and setting error as an abstract method? That at the very least would make the expectation clearer for subclasses.

      I haven’t contributed to Python before but am open to this as a first attempt if the direction makes sense.

    4. WilliamAyd commented on Oct 31, 2017

      @WilliamAyd
      WilliamAydmannequin
      on Oct 31, 2017
      Mannequin
      More actions

      And assuming that subclass requirement is intentional we could add an optional keyword argument to the HTMLParser that indicates what to do with errors, much like how encoding issues are handled within codecs. For backwards compatibility it can default to ignore, but fail and warn could be two alternate approaches that the error method could account for

    5. serhiy-storchaka
      added
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on Oct 31, 2017
    6. berkerpeksag commented on Jul 30, 2018

      @berkerpeksag
      berkerpeksag
      on Jul 30, 2018
      Member
      More actions

      HTMLParser.error() method was deprecated in Python 3.4 (88ebfb1#diff-1a7486df8279dbac7f20abd487947845R157) and removed in Python 3.5 (73a4359#diff-1a7486df8279dbac7f20abd487947845L171)

      _markupbase is a private and undocumented module and its only user is HTMLParser (sgmllib was removed from the stdlib in 2008) Since we already have removed HTMLParser.error(), I think we can just remove _markupbase.ParserBase.error() without a deprecation period.

    7. berkerpeksag
      added
      3.8 (EOL)end of lifeend of life
      on Jul 30, 2018
    8. srittau commented on Jul 30, 2018

      @srittau
      srittaumannequin
      on Jul 30, 2018
      MannequinAuthor
      More actions

      Good call. Maybe it's actually time to retire _markupbase and merge ParserBase into HTMLParser.

    9. berkerpeksag commented on Aug 23, 2018

      @berkerpeksag
      berkerpeksag
      on Aug 23, 2018
      Member
      More actions

      After triaging bpo-34480, I realized that we can't simply remove the error() method because the _markupbase.ParserBase() class still uses it. I've just closed PR 8562.

    10. ezio-melotti
      self-assigned this
      on Aug 25, 2018
    11. csabella commented on Jun 14, 2020

      @csabella
      csabella
      on Jun 14, 2020
      Contributor
      More actions

      @berker.peksag's last comment was he closed the PR on 23 August 2018. However, he reopened it on 6 January 2020 as @ezio.melotti mentioned that they are both needed.

      The PR for this issue is waiting to be re-reviewed by Ezio.

    12. csabella
      added
      3.10 (EOL)end of lifeend of life
      and removed
      3.8 (EOL)end of lifeend of life
      on Jun 14, 2020
    13. berkerpeksag commented on Jul 16, 2020

      @berkerpeksag
      berkerpeksag
      on Jul 16, 2020
      Member
      More actions

      New changeset e34bbfd by Berker Peksag in branch 'master':
      bpo-31844: Remove _markupbase.ParserBase.error() (GH-8562)
      e34bbfd

    14. berkerpeksag commented on Jul 16, 2020

      @berkerpeksag
      berkerpeksag
      on Jul 16, 2020
      Member
      More actions

      New changeset d4d127f by Berker Peksag in branch 'master':
      bpo-31844: Move whatsnew note to 3.10.rst (GH-21504)
      d4d127f

    15. berkerpeksag
      closed this as completedon Jul 16, 2020
    16. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    17. return42
      added 2 commits that reference this issue on Oct 18, 2023

      [fix] HTMLParser: undocumented not implemented method

      01cfc55

      [fix] HTMLParser: undocumented not implemented method

      8903910
    18. dalf
      added a commit that references this issue on Oct 22, 2023

      [fix] HTMLParser: undocumented not implemented method

      ef56e1d
    19. serhiy-storchaka
      added this to html.parser issueson Jun 20, 2025
    20. github-project-automation
      moved this to Todo in html.parser issueson Jun 20, 2025
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    • @ezio-melotti
      ezio-melotti

    Labels

    3.10 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • html.parser issues
      Status
      Todo
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.