Message361005
| Author |
hauntsaninja |
| Recipients |
eli.bendersky, hauntsaninja, scoder, serhiy.storchaka |
| Date |
2020-01-30.03:05:24 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1580353524.86.0.600581647564.issue39495@roundup.psfhosted.org> |
| In-reply-to |
|
| Content |
Based on https://github.com/python/cpython/blob/master/Modules/_elementtree.c#L2700 and the behaviour at runtime, something like the following patch could work:
```
diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py
index c8d898f328..bbfc1afe08 100644
--- a/Lib/xml/etree/ElementTree.py
+++ b/Lib/xml/etree/ElementTree.py
@@ -1452,7 +1452,7 @@ class TreeBuilder:
"""Add text to current element."""
self._data.append(data)
- def start(self, tag, attrs):
+ def start(self, tag, attrs=None):
"""Open new element and return it.
*tag* is the element name, *attrs* is a dict containing element
@@ -1460,6 +1460,8 @@ class TreeBuilder:
"""
self._flush()
+ if attrs is None:
+ attrs = {}
self._last = elem = self._factory(tag, attrs)
if self._elem:
self._elem[-1].append(elem)
```
Happy to submit a PR! |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2020-01-30 03:05:24 | hauntsaninja | set | recipients:
+ hauntsaninja, scoder, eli.bendersky, serhiy.storchaka |
| 2020-01-30 03:05:24 | hauntsaninja | set | messageid: <1580353524.86.0.600581647564.issue39495@roundup.psfhosted.org> |
| 2020-01-30 03:05:24 | hauntsaninja | link | issue39495 messages |
| 2020-01-30 03:05:24 | hauntsaninja | create | |
|