summaryrefslogtreecommitdiff
path: root/Lib/xml/etree/ElementTree.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-83122: Deprecate testing element truth values in `ElementTree` (#31149)Jacob Walls2023-01-221-2/+3
| | | | | | | When testing element truth values, emit a DeprecationWarning in all implementations. This had emitted a FutureWarning in the rarely used python-only implementation since ~2.7 and has always been documented as a behavior not to rely on. Matching an element in a tree search but having it test False can be unexpected. Raising the warning enables making the choice to finally raise an exception for this ambiguous behavior in the future.
* bpo-45975: Simplify some while-loops with walrus operator (GH-29347)Nick Drozd2022-11-261-4/+1
|
* gh-94383: Remove ElementTree.Element.copy() method (#94384)Victor Stinner2022-07-041-13/+0
| | | | | | xml.etree: Remove the ElementTree.Element.copy() method of the pure Python implementation, deprecated in Python 3.10, use the copy.copy() function instead. The C implementation of xml.etree has no copy() method, only a __copy__() method.
* gh-91810: Fix regression with writing an XML declaration with ↵Serhiy Storchaka2022-06-141-7/+5
| | | | | | | | | | encoding='unicode' (GH-93426) Suppress writing an XML declaration in open files in ElementTree.write() with encoding='unicode' and xml_declaration=None. If file patch is passed to ElementTree.write() with encoding='unicode', always open a new file in UTF-8.
* gh-91810: ElementTree: Use text file's encoding by default in XML ↵Serhiy Storchaka2022-05-111-14/+9
| | | | | | | | declaration (GH-91903) ElementTree method write() and function tostring() now use the text file's encoding ("UTF-8" if not available) instead of locale encoding in XML declaration when encoding="unicode" is specified.
* bpo-43292: Fix file leak in `ET.iterparse()` when not exhausted (GH-31696)Jacob Walls2022-03-071-7/+9
| | | Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-46786: Make ElementTree write the HTML tags embed, source, track, wbr as ↵Jannis Vajen2022-02-271-7/+3
| | | | | | empty tags (GH-31406) See https://html.spec.whatwg.org/multipage/syntax.html#void-elements for reference.
* Update URLs in comments and metadata to use HTTPS (GH-27458)Noah Kantrowitz2021-07-301-2/+2
|
* bpo-43399: Fix ElementTree.extend not working on iterators (GH-24751)Alex Prengère2021-03-311-1/+1
|
* bpo-42151: don't set specified_attributes=1 in pure Python ElementTree ↵Felix C. Stegerman2021-02-241-2/+0
| | | | (GH-22987)
* bpo-41900: C14N 2.0 serialisation failed for unprefixed attributes when a ↵scoder2020-10-031-0/+5
| | | | default namespace was defined. (GH-22474)
* bpo-39011: Preserve line endings within ElementTree attributes (GH-18468)mefistotelis2020-04-121-7/+7
| | | | | | | * bpo-39011: Preserve line endings within attributes Line endings within attributes were previously normalized to "\n" in Py3.7/3.8. This patch removes that normalization, as line endings which were replaced by entity numbers should be preserved in original form.
* bpo-32424: Deprecate xml.etree.ElementTree.Element.copy() in favor of ↵Gordon P. Hemsley2019-09-101-0/+7
| | | | copy.copy() (GH-12995)
* bpo-15999: Always pass bool instead of int to the expat parser. (GH-15622)Serhiy Storchaka2019-09-011-2/+2
|
* bpo-36543: Remove old-deprecated ElementTree features. (GH-12707)Serhiy Storchaka2019-09-011-31/+0
| | | | | Remove methods Element.getchildren(), Element.getiterator() and ElementTree.getiterator() and the xml.etree.cElementTree module.
* bpo-14465: Add an indent() function to xml.etree.ElementTree to pretty-print ↵Stefan Behnel2019-08-231-1/+52
| | | | XML trees (GH-15200)
* bpo-13611: C14N 2.0 implementation for ElementTree (GH-12966)Stefan Behnel2019-05-011-0/+331
| | | | | | | * Implement C14N 2.0 as a new canonicalize() function in ElementTree. Missing features: - prefix renaming in XPath expressions (tag and attribute text is supported) - preservation of original prefixes given redundant namespace declarations
* bpo-36676: Namespace prefix aware parsing support for the ET.XMLParser ↵Stefan Behnel2019-05-011-4/+26
| | | | | target (GH-12885) * bpo-36676: Implement namespace prefix aware parsing support for the XMLParser target in ElementTree.
* bpo-36673: Implement comment/PI parsing support for the TreeBuilder in ↵Stefan Behnel2019-05-011-4/+63
| | | | | | | | ElementTree. (#12883) * bpo-36673: Implement comment/PI parsing support for the TreeBuilder in ElementTree. * bpo-36673: Rewrite the comment/PI factory handling for the TreeBuilder in "_elementtree" to make it use the same factories as the ElementTree module, and to make it explicit when the comments/PIs are inserted into the tree and when they are not (which is the default).
* bpo-36227: ElementTree.tostring() default_namespace and xml_declaration ↵Bernt Røskar Brenna2019-04-141-3/+12
| | | | | arguments (GH-12225) Add new keyword arguments "default_namespace" and "xml_declaration" to functions ET.tostring() and ET.tostringlist(), as known from ElementTree.write().
* bpo-36431: Use PEP 448 dict unpacking for merging two dicts. (GH-12553)Serhiy Storchaka2019-03-271-5/+2
|
* bpo-34160: Preserve user specified order of Element attributes in html. ↵Serhiy Storchaka2018-10-291-1/+1
| | | | (GH-10190)
* bpo-34160: Preserve user specified order of Element attributes (GH-10163)Raymond Hettinger2018-10-281-1/+1
|
* bpo-35013: Add more type checks for children of Element. (GH-9944)Serhiy Storchaka2018-10-191-5/+5
| | | | | | It is now guarantied that children of xml.etree.ElementTree.Element are Elements (at least in C implementation). Previously methods __setitem__(), __setstate__() and __deepcopy__() could be used for adding non-Element children.
* bpo-29209: Remove old-deprecated features in ElementTree. (GH-6769)Serhiy Storchaka2018-07-241-31/+9
| | | | | Also make getchildren() and getiterator() emitting a DeprecationWarning instead of PendingDeprecationWarning.
* bpo-32297: Few misspellings found in Python source code comments. (#4803)Mike2017-12-141-1/+1
| | | | | | | | * Fix multiple typos in code comments * Add spacing in comments (test_logging.py, test_math.py) * Fix spaces at the beginning of comments in test_logging.py
* bpo-30144: Import collections ABC from collections.abc rather than ↵Serhiy Storchaka2017-04-241-1/+2
| | | | collections. (#1263)
* bpo-29204: Emit warnings for already deprecated ElementTree features. (#773)Serhiy Storchaka2017-03-301-1/+6
| | | | | | | | Element.getiterator() and the html parameter of XMLParser() were deprecated only in the documentation (since Python 3.2 and 3.4 correspondintly). Now using them emits a deprecation warning. * Don’t need check_warnings any more.
* mergeRaymond Hettinger2016-09-111-0/+11
|\
| * Issue #17582: xml.etree.ElementTree nows preserves whitespaces in attributesRaymond Hettinger2016-09-111-0/+11
| | | | | | | | (Patch by Duane Griffin. Reviewed and approved by Stefan Behnel.)
* | #27364: fix "incorrect" uses of escape character in the stdlib.R David Murray2016-09-081-1/+1
| | | | | | | | | | | | | | And most of the tools. Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and Martin Panter.
* | Merge Element Tree doc string from 3.5Martin Panter2016-06-041-1/+1
|\ \ | |/
| * Clarify deprecation of ElementTree.XMLParser(html=...) parameterMartin Panter2016-06-041-1/+1
| |
* | Issue #26676: Add missing XMLPullParser to ElementTree.__all__Martin Panter2016-04-011-1/+1
| |
* | Issue #25902: Fixed various refcount issues in ElementTree iteration.Serhiy Storchaka2015-12-211-4/+6
|\ \ | |/
| * Issue #25902: Fixed various refcount issues in ElementTree iteration.Serhiy Storchaka2015-12-211-4/+6
| |
* | Issue #25638: Optimized ElementTree.iterparse(); it is now 2x faster.Serhiy Storchaka2015-12-071-61/+31
|/ | | | | ElementTree.XMLParser._setevents now accepts any objects with the append method, not just a list.
* Issue #25688: Fixed file leak in ElementTree.iterparse() raising an error.Serhiy Storchaka2015-11-231-15/+26
|\
| * Issue #25688: Fixed file leak in ElementTree.iterparse() raising an error.Serhiy Storchaka2015-11-231-15/+26
| |
* | Issue #25047: Merge Element Tree encoding from 3.4 into 3.5Martin Panter2015-09-231-5/+4
|\ \ | |/
| * Issue #25047: Respect case writing XML encoding declarationsMartin Panter2015-09-231-5/+4
| | | | | | | | | | This restores the ability to write encoding names in uppercase like "UTF-8", which worked in Python 2.
* | Issue #23326: Removed __ne__ implementations. Since fixing default __ne__Serhiy Storchaka2015-01-311-4/+0
| | | | | | | | implementation in issue #21408 they are redundant.
* | Removed duplicated words in in comments and docs.Serhiy Storchaka2014-12-011-1/+1
|\ \ | |/
| * Removed duplicated words in in comments and docs.Serhiy Storchaka2014-12-011-1/+1
| |
* | Issue #22033: Reprs of most Python implemened classes now contain actualSerhiy Storchaka2014-07-251-2/+2
|/ | | | class name instead of hardcoded one.
* whatsnew: XMLPullParser, plus some doc updates.R David Murray2014-01-041-1/+1
| | | | | | | | | | I was confused by the text saying that read_events "iterated", since it actually returns an iterator (that's what a generator does) that the caller must then iterate. So I tidied up the language. I'm not sure what the sentence "Events provided in a previous call to read_events() will not be yielded again." is trying to convey, so I didn't try to fix that. Also fixed a couple more news items.
* Close #18990: remove root attribute from XMLPullParserNick Coghlan2013-09-281-10/+22
| | | | | | | | | | | | | - this was an internal implementation detail for iterparse - this has been changed to use a new private method instead - XMLPullParser.close docs are now more explicit about not returning a root element and instead direct users towards read_events - also added missing docstrings and clarified some details related to exactly *when* events are consumed from the internal queue (Initial patch by Stefan Behnel)
* Issue #17741: Rename IncrementalParser and its methods.Eli Bendersky2013-08-301-16/+20
| | | | | | The new names are hopefully more descriptive and consistent. If you feel you don't agree with this change, *please* read issue 17741 first - there's a lot of discussion in there.
* Remove the obsolete XMLParser._start/_start_list duality.Eli Bendersky2013-08-251-26/+12
| | | | | XMLParser configures expat to report attributes in a list (ordered_attributes), so only _start_list is needed. Rename it to _start and kill _start.
* Issue #17741: use composition, rather than inheritance, for ↵Antoine Pitrou2013-08-231-6/+8
| | | | | | xml.etree.iterparse's result class. Patch by Stefan Behnel.