Skip to content

Commit 3d62987

Browse files
tirangsnedders
authored andcommitted
Don't use cElementTree on Python 3
It's been deprecated and will be removed in 3.9 or 3.10. 3.9.0b1 doesn't have cElementTree. I'd like to bring it back with a deprecation warning to drop in 3.10. See: python/cpython#19921 Signed-off-by: Christian Heimes <[email protected]> Signed-off-by: Sam Sneddon <[email protected]>
1 parent d49afd3 commit 3d62987

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

html5lib/_utils.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
from types import ModuleType
44

5-
from six import text_type
5+
from six import text_type, PY3
66

7-
try:
8-
import xml.etree.cElementTree as default_etree
9-
except ImportError:
7+
if PY3:
108
import xml.etree.ElementTree as default_etree
9+
else:
10+
try:
11+
import xml.etree.cElementTree as default_etree
12+
except ImportError:
13+
import xml.etree.ElementTree as default_etree
1114

1215

1316
__all__ = ["default_etree", "MethodDispatcher", "isSurrogatePair",

0 commit comments

Comments
 (0)