Skip to content

Commit

Permalink
Silence deprecation warning when testing element's truth value
Browse files Browse the repository at this point in the history
This fixes the following deprecation warning, new as of Python 3.12:

DeprecationWarning: Testing an element's truth value will always return True in future versions.

We do want the future behavior here, but since we can't opt into it
cleanly just test vs None explicitly.
  • Loading branch information
zeux committed Jan 25, 2025
1 parent 23d3ab9 commit 564279c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def is_descendant_type(types, name, base):
if name == base:
return True
type = types.get(name)
if not type:
if type is None:
return False
parents = type.get('parent')
if not parents:
Expand Down

0 comments on commit 564279c

Please sign in to comment.