[Python-checkins] cpython (merge 3.2 -> default): #12888: merge with 3.2.
ezio.melotti
python-checkins at python.org
Mon Sep 5 16:16:31 CEST 2011
http://hg.python.org/cpython/rev/7b6096852665
changeset: 72271:7b6096852665
parent: 72269:31b3218794e2
parent: 72270:9896fc2a8167
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Mon Sep 05 17:15:32 2011 +0300
summary:
#12888: merge with 3.2.
files:
Lib/html/parser.py | 2 +-
Lib/test/test_htmlparser.py | 3 ++-
Misc/ACKS | 1 +
Misc/NEWS | 3 +++
4 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/Lib/html/parser.py b/Lib/html/parser.py
--- a/Lib/html/parser.py
+++ b/Lib/html/parser.py
@@ -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 --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py
--- a/Lib/test/test_htmlparser.py
+++ b/Lib/test/test_htmlparser.py
@@ -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 --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -704,6 +704,7 @@
Michele Orrù
Oleg Oshmyan
Denis S. Otkidach
+Peter Otten
Michael Otteneder
R. M. Oudkerk
Russel Owen
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -271,6 +271,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.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list