🌐 AI搜索 & 代理 主页
Skip to content

Commit 99cd4ef

Browse files
committed
bpo-36543: Mark cElementTree to be removed in 3.10
Signed-off-by: Christian Heimes <christian@python.org>
1 parent 2d920fe commit 99cd4ef

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

Doc/library/xml.etree.elementtree.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ for parsing and creating XML data.
1717
This module will use a fast implementation whenever available.
1818
The :mod:`xml.etree.cElementTree` module is deprecated.
1919

20+
.. versionchanged:: 3.9
21+
The :mod:`xml.etree.cElementTree` will be removed in Python 3.10.
2022

2123
.. warning::
2224

Doc/whatsnew/3.9.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,10 @@ Deprecated
626626
`parso`_.
627627
(Contributed by Carl Meyer in :issue:`40360`.)
628628

629+
* The :mod:`xml.etree.cElementTree` module has been deprecated since Python
630+
3.3 and is scheduled to be removed in Python 3.10.
631+
(Contributed by Serhiy Storchaka and Christian Heimes in :issue:`36543`)
632+
629633
.. _LibCST: https://libcst.readthedocs.io/
630634
.. _parso: https://parso.readthedocs.io/
631635

Lib/xml/etree/cElementTree.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
# Deprecated alias for xml.etree.ElementTree
22

33
from xml.etree.ElementTree import *
4+
5+
from warnings import warn as _warn
6+
7+
_warn(
8+
"xml.etree.cElementTree is deprecated, use xml.etree.ElementTree instead",
9+
PendingDeprecationWarning
10+
)
11+
12+
del _warn
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Re-add :mod:`xml.etree.cElementTree`, deprecate it in 3.9, and schedule it
2+
for removal in 3.10.

0 commit comments

Comments
 (0)