Skip to content

[3.11] gh-91447: Fix findtext to only give an empty string on None (GH-91486) #95543

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

Merged
merged 1 commit into from
Aug 1, 2022

Conversation

miss-islington
Copy link
Contributor

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 GH-91447.

Automerge-Triggered-By: GH:gvanrossum
(cherry picked from commit a95e60d)

Co-authored-by: Eugene Triguba eugenetriguba@gmail.com

…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>
@miss-islington
Copy link
Contributor Author

Status check is done, and it's a success ✅ .

1 similar comment
@miss-islington
Copy link
Contributor Author

Status check is done, and it's a success ✅ .

@miss-islington
Copy link
Contributor Author

Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit b12dba4 into python:3.11 Aug 1, 2022
@miss-islington miss-islington deleted the backport-a95e60d-3.11 branch August 1, 2022 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants