Skip to content

html.parser.HTMLParser.unescape works only with the first 128 entities #57097

Closed

Description

@yveszioupcom
BPO 12888
Nosy @ezio-melotti
Files
  • unescape_bug.patch
  • 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 2011-09-05.14:26:55.245>
    created_at = <Date 2011-09-02.21:08:40.271>
    labels = ['type-bug', 'library']
    title = 'html.parser.HTMLParser.unescape works only with the first 128 entities'
    updated_at = <Date 2011-09-05.14:26:55.242>
    user = 'https://bugs.python.org/yveszioupcom'

    bugs.python.org fields:

    activity = <Date 2011-09-05.14:26:55.242>
    actor = 'ezio.melotti'
    assignee = 'ezio.melotti'
    closed = True
    closed_date = <Date 2011-09-05.14:26:55.245>
    closer = 'ezio.melotti'
    components = ['Library (Lib)']
    creation = <Date 2011-09-02.21:08:40.271>
    creator = 'yves@zioup.com'
    dependencies = []
    files = ['23092']
    hgrepos = ['65']
    issue_num = 12888
    keywords = ['patch']
    message_count = 5.0
    messages = ['143434', '143457', '143459', '143512', '143513']
    nosy_count = 4.0
    nosy_names = ['peter.otten', 'ezio.melotti', 'yves@zioup.com', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue12888'
    versions = ['Python 3.2', 'Python 3.3']

    Activity

    1. yveszioupcom commented on Sep 2, 2011

      yveszioupcommannequin
      MannequinAuthor

      html.parser.HTMLParser.unescape works only with the first 128 entities, it leaves the other ones as they are.

    2. yveszioupcom commented on Sep 3, 2011

      yveszioupcommannequin
      MannequinAuthor

      Added a test case:
      http://hg.zioup.org/cpython/rev/4accd3181061

      If you set the loop < 128 then the test passes (set at 1000 right now).

    3. peterotten commented on Sep 3, 2011

      peterottenmannequin
      Mannequin

      The unescape() method uses re.sub(regex, sub, re.ASCII), but the third argument is count, not flags. Fix is easy: use

      re.sub(regex, sub, flags=re.ASCII).

    4. self-assigned this
      on Sep 3, 2011
    5. python-dev commented on Sep 5, 2011

      python-devmannequin
      Mannequin

      New changeset 9896fc2a8167 by Ezio Melotti in branch '3.2':
      bpo-12888: Fix a bug in HTMLParser.unescape that prevented it to escape more than 128 entities. Patch by Peter Otten.
      http://hg.python.org/cpython/rev/9896fc2a8167

      New changeset 7b6096852665 by Ezio Melotti in branch 'default':
      bpo-12888: merge with 3.2.
      http://hg.python.org/cpython/rev/7b6096852665

    6. ezio-melotti commented on Sep 5, 2011

      @ezio-melotti
      Member

      Fixed, thanks for the report and the patch!

    7. added
      stdlibStandard Library Python modules in the Lib/ directory
      on Sep 5, 2011
    8. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions