-
Notifications
You must be signed in to change notification settings - Fork 84
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
fix: Test xml.etree.ElementTree.Element truth value by 'is not None' #2459
Conversation
* In Python 3.14 testing the truth value of an xml.etree.ElementTree.Element is deprecated and will raise an exception. As of Python 3.12 this behavior will raise a DeprecationWarning: ``` DeprecationWarning: Testing an element's truth value will raise an exception in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. ``` To avoid this, determine the truth element by using the 'elem is not None' method.
This won't get properly fully tested until Python 3.12 is added to the CI matrix. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2459 +/- ##
==========================================
- Coverage 98.23% 98.21% -0.03%
==========================================
Files 69 69
Lines 4541 4541
Branches 804 804
==========================================
- Hits 4461 4460 -1
- Misses 46 48 +2
+ Partials 34 33 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I'm going to approve and merge this myself. As always, PRs approved by a single core dev can be reverted as needed by the rest of the dev team. |
@meeseeksdev backport to release/v0.7.x |
…truth value by 'is not None'
…not None' (#2499) * Backport PR #2459 * In Python 3.14 testing the truth value of an xml.etree.ElementTree.Element is deprecated and will raise an exception. As of Python 3.12 this behavior will raise a DeprecationWarning: ``` DeprecationWarning: Testing an element's truth value will raise an exception in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. ``` To avoid this, determine the truth element by using the 'elem is not None' method. - c.f. https://docs.python.org/3.12/library/xml.etree.elementtree.html#element-objects Co-authored-by: Matthew Feickert <[email protected]>
Description
Resolves #2453
In Python 3.14 testing the truth value of an
xml.etree.ElementTree.Element
is deprecated and will raise an exception. As of Python 3.12 this behavior will raise aDeprecationWarning
:To avoid this, determine the truth element by using the
elem is not None
method.Checklist Before Requesting Reviewer
Before Merging
For the PR Assignees: