Skip to content
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 ElementTree DeprecationWarning when testing truth value (3.12) #1209

Merged
merged 3 commits into from
Aug 27, 2023
Merged

Fix ElementTree DeprecationWarning when testing truth value (3.12) #1209

merged 3 commits into from
Aug 27, 2023

Conversation

cdce8p
Copy link
Contributor

@cdce8p cdce8p commented Aug 6, 2023

Description

Fix a DeprecationWarning for Python 3.12.

  /.../python3.12/site-packages/plexapi/client.py:97: 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.
    if not data:

From the Python 3.12 Changelog

xml.etree.ElementTree: The module now emits DeprecationWarning when testing the truth value of an xml.etree.ElementTree.Element. Before, the Python implementation emitted FutureWarning, and the C implementation emitted nothing.

https://github.com/python/cpython/blob/v3.12.0rc1/Lib/xml/etree/ElementTree.py#L201-L208

Type of change

  • Bug fix (non-breaking change which fixes an issue)

@jjlawren
Copy link
Collaborator

jjlawren commented Aug 6, 2023

Thanks, @cdce8p!

plexapi/client.py Outdated Show resolved Hide resolved
@JonnyWong16
Copy link
Collaborator

I found two more locations.

if not response:

if not response:

@cdce8p
Copy link
Contributor Author

cdce8p commented Aug 15, 2023

Anything left I should do here?

@JonnyWong16 JonnyWong16 merged commit ea4885a into pkkid:master Aug 27, 2023
3 checks passed
@cdce8p cdce8p deleted the 312-deprecation branch August 27, 2023 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants