Skip to content

Commit 8ae041c

Browse files
Fix: avoid mutable default arguments in ElementTree
1 parent af2dfbf commit 8ae041c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/xml/etree/ElementTree.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ class Element:
168168
169169
"""
170170

171-
def __init__(self, tag, attrib={}, **extra):
171+
def __init__(self, tag, attrib=None, **extra):
172+
if attrib is None:
173+
attrib = {}
172174
if not isinstance(attrib, dict):
173175
raise TypeError("attrib must be dict, not %s" % (
174176
attrib.__class__.__name__,))

0 commit comments

Comments
 (0)