summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_xml_etree.py2
-rw-r--r--Modules/_elementtree.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index 3092f3b..f61292f 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -352,6 +352,8 @@ def find():
'subtext'
>>> ET.ElementTree(elem).findtext("section/tag")
'subtext'
+ >>> ET.XML('<root><empty /></root>').findtext('empty')
+ ''
>>> summarize_list(elem.findall("."))
['body']
>>> summarize_list(elem.findall("tag"))
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index c36af5d..17d5d09 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -840,7 +840,7 @@ element_findtext(ElementObject* self, PyObject* args)
PyObject* text = element_get_text(item);
if (text == Py_None)
- return PyBytes_FromString("");
+ return PyUnicode_FromString("");
Py_XINCREF(text);
return text;
}