Skip to content

Commit 4e06f37

Browse files
committed
Move back to __import__ for 2.6
1 parent 1198aba commit 4e06f37

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

html5lib/treewalkers/__init__.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
returning an iterator generating tokens.
1111
"""
1212

13-
from importlib import import_module
13+
import sys
1414

1515
treeWalkerCache = {}
1616

@@ -38,7 +38,9 @@ def getTreeWalker(treeType, implementation=None, **kwargs):
3838
treeType = treeType.lower()
3939
if treeType not in treeWalkerCache:
4040
if treeType in ("dom", "pulldom", "simpletree"):
41-
mod = import_module("."+treeType, "html5lib.treewalkers")
41+
name = "html5lib.treewalkers." + treeType
42+
__import__(name)
43+
mod = sys.modules[name]
4244
treeWalkerCache[treeType] = mod.TreeWalker
4345
elif treeType == "genshi":
4446
from . import genshistream

0 commit comments

Comments
 (0)