Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f6ca26fb
Commit
f6ca26fb
authored
May 01, 2013
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Plain Diff
#17802: merge with 3.3.
parents
8a42d601
8e596a76
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
0 deletions
+18
-0
Lib/html/parser.py
Lib/html/parser.py
+1
-0
Lib/test/test_htmlparser.py
Lib/test/test_htmlparser.py
+14
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/html/parser.py
View file @
f6ca26fb
...
...
@@ -251,6 +251,7 @@ class HTMLParser(_markupbase.ParserBase):
if self.strict:
self.error("EOF in middle of entity or char ref")
else:
k = match.end()
if k <= i:
k = n
i = self.updatepos(i, i + 1)
...
...
Lib/test/test_htmlparser.py
View file @
f6ca26fb
...
...
@@ -535,6 +535,20 @@ class HTMLParserTolerantTestCase(HTMLParserStrictTestCase):
]
self
.
_run_check
(
html
,
expected
)
def
test_EOF_in_charref
(
self
):
# see #17802
# This test checks that the UnboundLocalError reported in the issue
# is not raised, however I'm not sure the returned values are correct.
# Maybe HTMLParser should use self.unescape for these
data
=
[
(
'a&'
,
[(
'data'
,
'a&'
)]),
(
'a&b'
,
[(
'data'
,
'ab'
)]),
(
'a&b '
,
[(
'data'
,
'a'
),
(
'entityref'
,
'b'
),
(
'data'
,
' '
)]),
(
'a&b;'
,
[(
'data'
,
'a'
),
(
'entityref'
,
'b'
)]),
]
for
html
,
expected
in
data
:
self
.
_run_check
(
html
,
expected
)
def
test_unescape_function
(
self
):
p
=
self
.
get_collector
()
self
.
assertEqual
(
p
.
unescape
(
'&#bad;'
),
'&#bad;'
)
...
...
Misc/NEWS
View file @
f6ca26fb
...
...
@@ -62,6 +62,9 @@ Library
- Issue #14679: add an __all__ (that contains only HTMLParser) to html.parser.
- Issue #17802: Fix an UnboundLocalError in html.parser. Initial tests by
Thomas Barlow.
- Issue #17358: Modules loaded by imp.load_source() and load_compiled() (and by
extention load_module()) now have a better chance of working when reloaded.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment