This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Remove old-deprecated ElementTree features
Type: enhancement Stage: resolved
Components: Extension Modules, Library (Lib), XML Versions: Python 3.8
Status: closed Resolution: fixed
Dependencies: 29204 Superseder:
Assigned To: Nosy List: cheryl.sabella, eli.bendersky, gphemsley, jdemeyer, ned.deily, scoder, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2017-01-08 17:56 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
etree_remove_deprecated.patch serhiy.storchaka, 2017-01-08 17:56 review
etree_remove_deprecated_getiterator.diff serhiy.storchaka, 2018-05-12 10:49 Remove getchildren() and getiterator()
etree_remove_deprecated_cElementTree.diff serhiy.storchaka, 2018-05-12 10:49 Remove xml.etree.cElementTree
Pull Requests
URL Status Linked Edit
PR 6769 merged serhiy.storchaka, 2018-05-12 10:11
Messages (9)
msg285000 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-01-08 17:56
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 issue29204). But if commit the patch from issue29204 in 3.6, perhaps deprecated features could be removed in 3.7.
msg309891 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2018-01-13 17:10
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.
msg311330 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2018-01-31 13:47

Did you want to revive this for 3.8?
msg316422 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-05-12 08:46
getchildren() and getiterator() have deprecation notes in their docstrings in lxml.etree.
msg316423 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-05-12 10:20
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.
msg316424 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-05-12 10:49
The following two patches will remove getchildren() and getiterator() (in 3.9) and xml.etree.cElementTree (in an unspecified future).
msg322280 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-07-24 09:03
New changeset 02ec92fa7b1dddc23d479ee0b87dc283793505a8 by Serhiy Storchaka in branch 'master':
bpo-29209: Remove old-deprecated features in ElementTree. (GH-6769)
msg339489 - (view) Author: Jeroen Demeyer (jdemeyer) * (Python triager) Date: 2019-04-05 10:10
This should be closed.
msg339534 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-04-06 16:16
The rest will be removed in issue36543.
Date User Action Args
2022-04-11 14:58:41adminsetgithub: 73395
2019-04-06 16:16:03serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg339534

stage: patch review -> resolved
2019-04-05 10:10:02jdemeyersetnosy: + jdemeyer
messages: + msg339489
2018-07-24 09:03:40serhiy.storchakasetmessages: + msg322280
2018-05-12 10:51:04serhiy.storchakasetversions: + Python 3.8, - Python 3.7
2018-05-12 10:49:51serhiy.storchakasetfiles: + etree_remove_deprecated_cElementTree.diff
2018-05-12 10:49:22serhiy.storchakasetfiles: + etree_remove_deprecated_getiterator.diff

messages: + msg316424
2018-05-12 10:20:04serhiy.storchakasetmessages: + msg316423
2018-05-12 10:11:53serhiy.storchakasetpull_requests: + pull_request6457
2018-05-12 08:46:03serhiy.storchakasetmessages: + msg316422
2018-01-31 13:47:37cheryl.sabellasetnosy: + cheryl.sabella
messages: + msg311330
2018-01-13 17:10:33scodersetmessages: + msg309891
2017-12-24 19:23:22gphemsleysetnosy: + gphemsley
2017-01-08 17:56:53serhiy.storchakasetdependencies: + Add code deprecations in ElementTree
2017-01-08 17:56:24serhiy.storchakacreate