Repository navigation
Remove old-deprecated ElementTree features #73395
Copy link
Copy link
Closed
Labels
3.8 (EOL)end of lifeend of lifeextension-modulesC modules in the Modules dirC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-XMLtype-featureA feature request or enhancementA feature request or enhancement
Description
| BPO | 29209 |
|---|---|
| Nosy | @scoder, @ned-deily, @serhiy-storchaka, @jdemeyer, @csabella, @GPHemsley |
| PRs | |
| Dependencies | |
| Files |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = <Date 2019-04-06.16:16:03.335>
created_at = <Date 2017-01-08.17:56:24.989>
labels = ['extension-modules', 'expert-XML', '3.8', 'type-feature', 'library']
title = 'Remove old-deprecated ElementTree features'
updated_at = <Date 2019-04-06.16:16:03.333>
user = 'https://github.com/serhiy-storchaka'bugs.python.org fields:
activity = <Date 2019-04-06.16:16:03.333>
actor = 'serhiy.storchaka'
assignee = 'none'
closed = True
closed_date = <Date 2019-04-06.16:16:03.335>
closer = 'serhiy.storchaka'
components = ['Extension Modules', 'Library (Lib)', 'XML']
creation = <Date 2017-01-08.17:56:24.989>
creator = 'serhiy.storchaka'
dependencies = ['29204']
files = ['46216', '47584', '47585']
hgrepos = []
issue_num = 29209
keywords = ['patch']
message_count = 9.0
messages = ['285000', '309891', '311330', '316422', '316423', '316424', '322280', '339489', '339534']
nosy_count = 7.0
nosy_names = ['scoder', 'ned.deily', 'eli.bendersky', 'serhiy.storchaka', 'jdemeyer', 'cheryl.sabella', 'gphemsley']
pr_nums = ['6769']
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue29209'
versions = ['Python 3.8']Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.8 (EOL)end of lifeend of lifeextension-modulesC modules in the Modules dirC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-XMLtype-featureA feature request or enhancementA feature request or enhancement
Activity
serhiy-storchaka commentedon Jan 8, 2017
Proposed patch removes old-deprecated ElementTree features.
Methods Element.getchildren(), Element.getiterator() and ElementTree.getiterator() deprecated in 2.7 and 3.2.
Use list(elem) or iteration instead of getchildren(), methods iter() instead of getiterator().
The html argument of XMLParser deprecated in 3.4.
The rest of arguments are keyword-only now (passing them as keywords was recommended in the documentatin).
The support of the doctype() method of XMLParser subclasses and its default implementation. Deprecated in 3.2. Define the doctype() method on a custom TreeBuilder target instead.
The xml.etree.cElementTree module deprecated in 3.3.
Unfortunately some of these deprecations are in the documentation only or in Python implementatation, but not in C implementatation. Perhaps missed warnings should be added first (see bpo-29204). But if commit the patch from bpo-29204 in 3.6, perhaps deprecated features could be removed in 3.7.
scoder commentedon Jan 13, 2018
Patch looks right to me.
I'd personally be ok with applying it to 3.7, but I'll leave the decision to you. Most of the removed "features" are non-controversial, except:
"getchildren()" is probably still in use, also because it's more efficient than "list(elem)" in lxml (and has never been deprecated there), so code that supports both libraries might have preferred it
cElementTree is probably still imported by quite a bit of code
So, this will have an impact on user code, despite any previous deprecation warnings. But it's easy to resolve in a backwards compatible way.
csabella commentedon Jan 31, 2018
Serhiy,
Did you want to revive this for 3.8?
serhiy-storchaka commentedon May 12, 2018
getchildren() and getiterator() have deprecation notes in their docstrings in lxml.etree.
serhiy-storchaka commentedon May 12, 2018
PR 6769 removes the html parameter and the doctype() method. getchildren() and getiterator() emit now a DeprecationWarning instead of PendingDeprecationWarning and will be removed in 3.9.
serhiy-storchaka commentedon May 12, 2018
The following two patches will remove getchildren() and getiterator() (in 3.9) and xml.etree.cElementTree (in an unspecified future).
serhiy-storchaka commentedon Jul 24, 2018
New changeset 02ec92f by Serhiy Storchaka in branch 'master':
bpo-29209: Remove old-deprecated features in ElementTree. (GH-6769)
02ec92f
jdemeyer commentedon Apr 5, 2019
This should be closed.
serhiy-storchaka commentedon Apr 6, 2019
The rest will be removed in bpo-36543.
Replace removed getchildren method