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 <christian@python.org> Signed-off-by: Sam Sneddon <me@gsnedders.com>
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy