summaryrefslogtreecommitdiffstats
path: root/Lib/HTMLParser.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/HTMLParser.py')
-rw-r--r--Lib/HTMLParser.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/HTMLParser.py b/Lib/HTMLParser.py
index 3f97830..fb9380e 100644
--- a/Lib/HTMLParser.py
+++ b/Lib/HTMLParser.py
@@ -462,11 +462,12 @@ class HTMLParser(markupbase.ParserBase):
else:
# Cannot use name2codepoint directly, because HTMLParser supports apos,
# which is not part of HTML 4
- import htmlentitydefs
if HTMLParser.entitydefs is None:
- entitydefs = HTMLParser.entitydefs = {'apos':u"'"}
+ import htmlentitydefs
+ entitydefs = {'apos':u"'"}
for k, v in htmlentitydefs.name2codepoint.iteritems():
entitydefs[k] = unichr(v)
+ HTMLParser.entitydefs = entitydefs
try:
return self.entitydefs[s]
except KeyError: