summaryrefslogtreecommitdiffstats
path: root/Lib/xml
Commit message (Collapse)AuthorAgeFilesLines
* Fix typos in comments and test code (#122846)Xie Yanbo2024-08-121-1/+1
|
* gh-120417: Fix "imported but unused" linter warnings (#120461)Victor Stinner2024-06-141-4/+10
| | | | | | | | | | | Add __all__ to the following modules: importlib.machinery, importlib.util and xml.sax. Add also "# noqa: F401" in collections.abc, subprocess and xml.sax. * Sort __all__; remove collections.abc.__all__; remove private names * Add tests
* gh-120417: Add #noqa to used imports in the stdlib (#120421)Victor Stinner2024-06-131-1/+1
| | | | | Tools such as ruff can ignore "imported but unused" warnings if a line ends with "# noqa: F401". It avoids the temptation to remove an import which is used effectively.
* gh-119577: Adjust DeprecationWarning when testing element truth values in ↵Jacob Walls2024-06-071-1/+1
| | | | | ElementTree (GH-119762) Adjust DeprecationWarning when testing element truth values in ElementTree, we're planning to go with the more natural True return rather than a disruptive harder to code around exception raise, and are deferring the behavior change for a few more releases.
* gh-101549: fix documentation of xml.etree.ElementInclude (#101550)Mikhail B2024-04-111-6/+7
| | | | | Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
* gh-115398: Expose Expat >=2.6.0 reparse deferral API (CVE-2023-52425) ↵Sebastian Pipping2024-02-292-0/+28
| | | | | | | | | | | | | | | | | | | | | (GH-115623) Allow controlling Expat >=2.6.0 reparse deferral (CVE-2023-52425) by adding five new methods: - `xml.etree.ElementTree.XMLParser.flush` - `xml.etree.ElementTree.XMLPullParser.flush` - `xml.parsers.expat.xmlparser.GetReparseDeferralEnabled` - `xml.parsers.expat.xmlparser.SetReparseDeferralEnabled` - `xml.sax.expatreader.ExpatParser.flush` Based on the "flush" idea from https://github.com/python/cpython/pull/115138#issuecomment-1932444270 . ### Notes - Please treat as a security fix related to CVE-2023-52425. Includes code suggested-by: Snild Dolkow <snild@sony.com> and by core dev Serhiy Storchaka.
* gh-69893: Add the close() method for xml.etree.ElementTree.iterparse() ↵Serhiy Storchaka2024-02-041-1/+8
| | | | iterator (GH-114534)
* gh-114737: Revert change to ElementTree.iterparse "root" attribute (GH-114755)Sam Gross2024-01-311-1/+1
| | | | | | Prior to gh-114269, the iterator returned by ElementTree.iterparse was initialized with the root attribute as None. This restores the previous behavior.
* gh-101438: Avoid reference cycle in ElementTree.iterparse. (GH-114269)Sam Gross2024-01-231-10/+17
| | | | | | The iterator returned by ElementTree.iterparse() may hold on to a file descriptor. The reference cycle prevented prompt clean-up of the file descriptor if the returned iterator was not exhausted.
* gh-50002: xml.dom.minidom now preserves whitespaces in attributes (GH-107947)Serhiy Storchaka2023-08-231-7/+23
| | | | Also double quotes (") are now only quoted in attributes.
* gh-83122: Deprecate testing element truth values in `ElementTree` (#31149)Jacob Walls2023-01-231-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.
* gh-99482: remove `jython` compatibility parts from stdlib and tests (#99484)Nikita Sobolev2022-12-233-27/+4
|
* bpo-45975: Simplify some while-loops with walrus operator (GH-29347)Nick Drozd2022-11-263-11/+3
|
* gh-96175: add missing self._localName assignment in `xml.dom.minidom.Attr` ↵Kevin Kirsche2022-08-231-0/+2
| | | | | | | (#96176) X-Ref: https://github.com/python/typeshed/pull/8590#discussion_r951473977 Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-91447: Fix findtext to only give an empty string on None (GH-91486)Eugene Triguba2022-08-011-1/+3
| | | | | The API documentation for [findtext](https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.findtext) states that this function gives back an empty string on "no text content." With the previous implementation, this would give back a empty string even on text content values such as 0 or False. This patch attempts to resolve that by only giving back an empty string if the text attribute is set to `None`. Resolves #91447. Automerge-Triggered-By: GH:gvanrossum
* 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.
* bpo-45132 Remove deprecated __getitem__ methods (GH-28225)Hugo van Kemenade2021-09-081-13/+0
| | | | | Remove deprecated __getitem__ methods of xml.dom.pulldom.DOMEventStream, wsgiref.util.FileWrapper and fileinput.FileInput, deprecated since Python 3.9.
* Update URLs in comments and metadata to use HTTPS (GH-27458)Noah Kantrowitz2021-07-304-5/+5
|
* Remove effbot urls (GH-26308)E-Paine2021-05-221-1/+0
|
* bpo-43399: Fix ElementTree.extend not working on iterators (GH-24751)Alex Prengère2021-03-301-1/+1
|
* bpo-42151: don't set specified_attributes=1 in pure Python ElementTree ↵Felix C. Stegerman2021-02-241-2/+0
| | | | (GH-22987)
* bpo-40624: Add support for the XPath != operator in xml.etree (GH-22147)Ammar Askar2020-11-091-7/+24
|
* bpo-41900: C14N 2.0 serialisation failed for unprefixed attributes when a ↵scoder2020-10-031-0/+5
| | | | default namespace was defined. (GH-22474)
* bpo-35018: Sax parser should provide user access to lexical handlers (GH-20958)Zackery Spytz2020-08-091-0/+45
| | | Co-Authored-By: Jonathan Gossage <jgossage@gmail.com>
* bpo-36543: Revert "bpo-36543: Remove the xml.etree.cElementTree module." ↵Serhiy Storchaka2020-06-101-0/+3
| | | | | | | (GH-20117) * Revert "bpo-36543: Remove the xml.etree.cElementTree module. (GH-19108)" This reverts commit b33e52511a59c6da7132c226b7f7489b092a33eb.
* bpo-40443: Remove unused imports in the stdlib (GH-19803)Victor Stinner2020-04-301-1/+0
|
* bpo-13743: Add some documentation strings to xml.dom.minidom (GH-16355)Alex Itkes2020-04-121-0/+23
|
* 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-36543: Remove the xml.etree.cElementTree module. (GH-19108)Serhiy Storchaka2020-03-221-3/+0
|
* bpo-37534: Allow adding Standalone Document Declaration when generating XML ↵Henry Harutyunyan2020-02-291-10/+16
| | | | documents (GH-14912)
* bpo-20928: support base-URL and recursive includes in etree.ElementInclude ↵Stefan Behnel2019-11-251-7/+49
| | | | | | | | | | | | (#5723) * bpo-20928: bring elementtree's XInclude support en-par with the implementation in lxml by adding support for recursive includes and a base-URL. * bpo-20928: Support xincluding the same file multiple times, just not recursively. * bpo-20928: Add 'max_depth' parameter to xinclude that limits the maximum recursion depth to 6 by default. * Add news entry for updated ElementInclude support
* Remove binding of captured exceptions when not used to reduce the chances of ↵Pablo Galindo2019-11-191-1/+1
| | | | | | | creating cycles (GH-17246) Capturing exceptions into names can lead to reference cycles though the __traceback__ attribute of the exceptions in some obscure cases that have been reported previously and fixed individually. As these variables are not used anyway, we can remove the binding to reduce the chances of creating reference cycles. See for example GH-13135
* 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-013-13/+13
|
* 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-36831: Do not apply default namespace to unprefixed attributes in ↵Stefan Behnel2019-05-091-5/+8
| | | | | ElementPath. (#13201) Also provide better grouping of the tokenizer tests.
* bpo-28238: Implement "{*}tag" and "{ns}*" wildcard tag selection support for ↵Stefan Behnel2019-05-031-10/+80
| | | | ElementPath, and extend the surrounding tests and docs. (GH-12997)
* 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-30485: Change the prefix for defining the default namespace in ↵Stefan Behnel2019-04-181-6/+2
| | | | ElementPath from None to '' since there is existing code that uses that and it's more convenient to have an all-string-keys dict (e.g. when sorting items etc.). (#12860)
* bpo-30485: Re-allow empty strings in ElementPath namespace mappings since ↵Stefan Behnel2019-04-141-2/+0
| | | | they might actually be harmless and unused (and thus went undetected previously). (#12830)
* bpo-31658: Make xml.sax.parse accepting Path objects (GH-8564)Mickaël Schoentgen2019-04-141-0/+2
|
* bpo-30485: support a default prefix mapping in ElementPath by passing None ↵Stefan Behnel2019-04-141-9/+24
| | | | as prefix (#1823)
* 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().