gh-119577: Adjust DeprecationWarning when testing element truth values in ElementTree (GH-119762)

Adjust DeprecationWarning when testing element truth values in ElementTree, we're planning to go with the more natural True return rather than a disruptive harder to code around exception raise, and are deferring the behavior change for a few more releases.
This commit is contained in:
Jacob Walls 2024-06-06 23:18:30 -04:00 committed by GitHub
parent 14e1506a6d
commit 6b606522ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 21 additions and 13 deletions

View file

@ -1502,7 +1502,7 @@ element_bool(PyObject* self_)
{
ElementObject* self = (ElementObject*) self_;
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"Testing an element's truth value will raise an exception "
"Testing an element's truth value will always return True "
"in future versions. Use specific 'len(elem)' or "
"'elem is not None' test instead.",
1) < 0) {