We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e7a0efb commit 1257936Copy full SHA for 1257936
1 file changed
markdown/htmlparser.py
@@ -40,7 +40,11 @@
40
# Users can still do `from html import parser` and get the default behavior.
41
spec = importlib.util.find_spec('html.parser')
42
htmlparser = importlib.util.module_from_spec(spec)
43
-spec.loader.exec_module(htmlparser)
+if hasattr(spec.loader, 'exec_module'):
44
+ spec.loader.exec_module(htmlparser)
45
+else:
46
+ import importlib
47
+ htmlparser.__dict__.update(importlib.import_module('html.parser').__dict__)
48
sys.modules['htmlparser'] = htmlparser
49
50
# This is a hack. We are sneaking in `</>` so we can capture it without the HTML parser
0 commit comments