New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-91447: Fix findtext to only give an empty string on None #91486
gh-91447: Fix findtext to only give an empty string on None #91486
Conversation
The API documentation for it states that this function gives back an empty string on "no text content." With the previous implementation, this would give back an emtpy string even on text content values such as 0 or False. This attempts to resolve that by only giving back an empty string if the text attribute is set to None.
@serhiy-storchaka This is in reference to line 419 and line 422? |
Are you also referring to line 2742 and line 2751? |
Status check is done, and it's a success |
@pablogsal Do you recommend backporting this to 3.11? It's been like that forever, so it doesn't strike me as urgent. If not to 3.11, would it go into 3.11.1 or stay in 3.12? |
Thanks for checking with me! Yeah, I think is ok to backport to 3.11 given that is a small fix that's fixing an existing bug. But please, let's do it before rc1 :) |
Thanks @eugenetriguba for the PR |
GH-95543 is a backport of this pull request to the 3.11 branch. |
…thonGH-91486) The API documentation for [findtext](https://docs.python.org/3/library/xml.etree.elementtree.htmlGH-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 pythonGH-91447. Automerge-Triggered-By: GH:gvanrossum (cherry picked from commit a95e60d) Co-authored-by: Eugene Triguba <eugenetriguba@gmail.com>
The API documentation for [findtext](https://docs.python.org/3/library/xml.etree.elementtree.htmlGH-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 GH-91447. Automerge-Triggered-By: GH:gvanrossum (cherry picked from commit a95e60d) Co-authored-by: Eugene Triguba <eugenetriguba@gmail.com>
The API documentation for 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