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.

classification
Title: Backport warnings in ElementTree/cElementTree modules and fix bugs
Type: behavior Stage: resolved
Components: Extension Modules, Library (Lib), XML Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, eli.bendersky, scoder, serhiy.storchaka
Priority: normal Keywords:

Created on 2017-05-14 15:38 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1581 merged serhiy.storchaka, 2017-05-14 15:44
Messages (4)
msg293652 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-05-14 15:38
Proposed patch add warnings in ElementTree and cElementTree modules (backports issue29204) when run Python with the -3 option and fixes several bugs in the etree package and its tests:

The deprecation warning about the doctype() method was emitted when use xml.etree.ElementTree.XMLParser. Now it emitted only when use a subclass of XMLParser with defined doctype() method, as intended.

In the test_bug_200708_close test an EchoTarget instance was incorrectly passed to XMLParser() as the html argument and silently ignored. Now it is passed as the target argument.

Tests no longer failed when use the -m option for running only selected test methods. Checking warnings now is more specific, warnings are expected only when use deprecated features.
msg293653 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2017-05-14 15:59
Looks good to me (didn't test it).

Note that getchildren() is not deprecated in lxml because it's actually the fastest way to build a list of the children. It's faster than list(element) because it avoids the Python (C-level) iteration overhead. However, that probably wouldn't be substantial enough to merit adding it if it wasn't there already. I'm ok with deprecating the method in ET. It's redundant there.
msg293654 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-05-14 16:29
getchildren() and getiterator() were deprecated in Python implementation for years (since updating to ElementTree 1.3 in Python 2.7 and 3.2). And they are documented as deprecated. Just C implementation didn't emit warnings. It may be too late to add unconditional deprecation warnings, but we can add them as Py3k warnings.

I'm going to remove these deprecated methods in 3.8.
msg293846 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-05-17 07:08
New changeset 09b52471f39ba280d836b945d47719c697af0b45 by Serhiy Storchaka in branch '2.7':
bpo-30365: Backport warnings and fix bugs in ElementTree. (#1581)
https://github.com/python/cpython/commit/09b52471f39ba280d836b945d47719c697af0b45
History
Date User Action Args
2022-04-11 14:58:46adminsetgithub: 74550
2017-05-18 17:58:55serhiy.storchakalinkissue29948 superseder
2017-05-17 07:09:16serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-05-17 07:08:14serhiy.storchakasetmessages: + msg293846
2017-05-14 16:29:33serhiy.storchakasetmessages: + msg293654
2017-05-14 15:59:15scodersetmessages: + msg293653
2017-05-14 15:44:28serhiy.storchakasetpull_requests: + pull_request1674
2017-05-14 15:38:54serhiy.storchakacreate