Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge remote-tracking branch 'upstream/main' into gh-144270-subelemen…
…t-positional-only
  • Loading branch information
NekoAsakura committed Mar 30, 2026
commit 6f43dc8d39eb471fa8888d81510c28d38e65c349
6 changes: 6 additions & 0 deletions Doc/library/xml.etree.elementtree.rst
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,9 @@ Functions
attributes. *extra* contains additional attributes, given as keyword
arguments. Returns an element instance.

.. versionchanged:: 3.15
Comment thread
NekoAsakura marked this conversation as resolved.
*attrib* can now be a :class:`frozendict`.

.. versionchanged:: next
*parent* and *tag* are now positional-only parameters.

Expand Down Expand Up @@ -890,6 +893,9 @@ Element Objects
an optional dictionary, containing element attributes. *extra* contains
additional attributes, given as keyword arguments.

.. versionchanged:: 3.15
*attrib* can now be a :class:`frozendict`.

.. versionchanged:: next
*tag* is now a positional-only parameter.

Expand Down
4 changes: 2 additions & 2 deletions Lib/xml/etree/ElementTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ class Element:
"""

def __init__(self, tag, /, attrib={}, **extra):
if not isinstance(attrib, dict):
raise TypeError("attrib must be dict, not %s" % (
if not isinstance(attrib, (dict, frozendict)):
raise TypeError("attrib must be dict or frozendict, not %s" % (
attrib.__class__.__name__,))
self.tag = tag
self.attrib = {**attrib, **extra}
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.