diff options
author | Eugene Triguba <eugenetriguba@gmail.com> | 2022-08-01 16:52:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-01 16:52:39 (GMT) |
commit | a95e60db748ec6f2c19b5710c11f62e1e4d669f4 (patch) | |
tree | f8604f233cab3f2839bf53c59c086841580e211d /Misc | |
parent | 858c9a58bf56cefc792bf0eb1ba22984b7b2d150 (diff) | |
download | cpython-a95e60db748ec6f2c19b5710c11f62e1e4d669f4.zip cpython-a95e60db748ec6f2c19b5710c11f62e1e4d669f4.tar.gz cpython-a95e60db748ec6f2c19b5710c11f62e1e4d669f4.tar.bz2 |
gh-91447: Fix findtext to only give an empty string on None (GH-91486)
The API documentation for [findtext](https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.findtext) states that this function gives back an empty string on "no text content." With the previous implementation, this would give back a empty string even on text content values such as 0 or False. This patch attempts to resolve that by only giving back an empty string if the text attribute is set to `None`. Resolves #91447.
Automerge-Triggered-By: GH:gvanrossum
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2022-04-12-18-05-40.gh-issue-91447.N_Fs4H.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2022-04-12-18-05-40.gh-issue-91447.N_Fs4H.rst b/Misc/NEWS.d/next/Library/2022-04-12-18-05-40.gh-issue-91447.N_Fs4H.rst new file mode 100644 index 0000000..6f9be2d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-04-12-18-05-40.gh-issue-91447.N_Fs4H.rst @@ -0,0 +1,2 @@ +Fix findtext in the xml module to only give an empty string when the text +attribute is set to None. |