Kaydet (Commit) 50f948ed authored tarafından Serhiy Storchaka's avatar Serhiy Storchaka Kaydeden (comit) GitHub

bpo-30011: Fixed race condition in HTMLParser.unescape(). (#1140)

üst 5fbdfc36
...@@ -462,11 +462,12 @@ class HTMLParser(markupbase.ParserBase): ...@@ -462,11 +462,12 @@ class HTMLParser(markupbase.ParserBase):
else: else:
# Cannot use name2codepoint directly, because HTMLParser supports apos, # Cannot use name2codepoint directly, because HTMLParser supports apos,
# which is not part of HTML 4 # which is not part of HTML 4
import htmlentitydefs
if HTMLParser.entitydefs is None: if HTMLParser.entitydefs is None:
entitydefs = HTMLParser.entitydefs = {'apos':u"'"} import htmlentitydefs
entitydefs = {'apos':u"'"}
for k, v in htmlentitydefs.name2codepoint.iteritems(): for k, v in htmlentitydefs.name2codepoint.iteritems():
entitydefs[k] = unichr(v) entitydefs[k] = unichr(v)
HTMLParser.entitydefs = entitydefs
try: try:
return self.entitydefs[s] return self.entitydefs[s]
except KeyError: except KeyError:
......
...@@ -42,6 +42,8 @@ Extension Modules ...@@ -42,6 +42,8 @@ Extension Modules
Library Library
------- -------
- bpo-30011: Fixed race condition in HTMLParser.unescape().
- bpo-30068: _io._IOBase.readlines will check if it's closed first when - bpo-30068: _io._IOBase.readlines will check if it's closed first when
hint is present. hint is present.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment