changeset: 72270:9896fc2a8167 branch: 3.2 parent: 72268:b38fdedb29d9 user: Ezio Melotti date: Mon Sep 05 17:11:06 2011 +0300 files: Lib/html/parser.py Lib/test/test_htmlparser.py Misc/ACKS Misc/NEWS description: #12888: Fix a bug in HTMLParser.unescape that prevented it to escape more than 128 entities. Patch by Peter Otten. diff -r b38fdedb29d9 -r 9896fc2a8167 Lib/html/parser.py --- a/Lib/html/parser.py Mon Sep 05 00:14:09 2011 +0200 +++ b/Lib/html/parser.py Mon Sep 05 17:11:06 2011 +0300 @@ -458,4 +458,4 @@ return '&'+s+';' return re.sub(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));", - replaceEntities, s, re.ASCII) + replaceEntities, s, flags=re.ASCII) diff -r b38fdedb29d9 -r 9896fc2a8167 Lib/test/test_htmlparser.py --- a/Lib/test/test_htmlparser.py Mon Sep 05 00:14:09 2011 +0200 +++ b/Lib/test/test_htmlparser.py Mon Sep 05 17:11:06 2011 +0300 @@ -377,7 +377,8 @@ p = html.parser.HTMLParser() self.assertEqual(p.unescape('&#bad;'),'&#bad;') self.assertEqual(p.unescape('&'),'&') - + # see #12888 + self.assertEqual(p.unescape('{ ' * 1050), '{ ' * 1050) def test_main(): support.run_unittest(HTMLParserTestCase, HTMLParserTolerantTestCase) diff -r b38fdedb29d9 -r 9896fc2a8167 Misc/ACKS --- a/Misc/ACKS Mon Sep 05 00:14:09 2011 +0200 +++ b/Misc/ACKS Mon Sep 05 17:11:06 2011 +0300 @@ -661,6 +661,7 @@ Michele OrrĂ¹ Oleg Oshmyan Denis S. Otkidach +Peter Otten Michael Otteneder R. M. Oudkerk Russel Owen diff -r b38fdedb29d9 -r 9896fc2a8167 Misc/NEWS --- a/Misc/NEWS Mon Sep 05 00:14:09 2011 +0200 +++ b/Misc/NEWS Mon Sep 05 17:11:06 2011 +0300 @@ -25,6 +25,9 @@ Library ------- +- Issue #12888: Fix a bug in HTMLParser.unescape that prevented it to escape + more than 128 entities. Patch by Peter Otten. + - Issue #12878: Expose a __dict__ attribute on io.IOBase and its subclasses. - Issue #12636: IDLE reads the coding cookie when executing a Python script.