Shantanu <hauntsani...@gmail.com> added the comment:

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!

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39495>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to