diff options
author | Jacob Walls <jacobtylerwalls@gmail.com> | 2023-01-23 01:16:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-23 01:16:48 (GMT) |
commit | d717be04dc7876696cb21ce7901bda0214c4b2e0 (patch) | |
tree | 32f9d28061733ce7c115474b76d77ea14fb209c5 /Misc | |
parent | 997073c28b2f8d199ff97759775208bc9a99b2b3 (diff) | |
download | cpython-d717be04dc7876696cb21ce7901bda0214c4b2e0.zip cpython-d717be04dc7876696cb21ce7901bda0214c4b2e0.tar.gz cpython-d717be04dc7876696cb21ce7901bda0214c4b2e0.tar.bz2 |
gh-83122: Deprecate testing element truth values in `ElementTree` (#31149)
When testing element truth values, emit a DeprecationWarning in all implementations.
This had emitted a FutureWarning in the rarely used python-only implementation since ~2.7 and has always been documented as a behavior not to rely on.
Matching an element in a tree search but having it test False can be unexpected. Raising the warning enables making the choice to finally raise an exception for this ambiguous behavior in the future.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2022-02-05-12-01-58.bpo-38941.8IhvyG.rst | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2022-02-05-12-01-58.bpo-38941.8IhvyG.rst b/Misc/NEWS.d/next/Library/2022-02-05-12-01-58.bpo-38941.8IhvyG.rst new file mode 100644 index 0000000..5f99604 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-02-05-12-01-58.bpo-38941.8IhvyG.rst @@ -0,0 +1,4 @@ +The :mod:`xml.etree.ElementTree` module now emits :exc:`DeprecationWarning` +when testing the truth value of an :class:`xml.etree.ElementTree.Element`. +Before, the Python implementation emitted :exc:`FutureWarning`, and the C +implementation emitted nothing. |