Skip to content

Commit

Permalink
More error checking in feature detection (#1088)
Browse files Browse the repository at this point in the history
importlib.metadata.version() can return None in some cases, even though
it's not documented as doing so.  Treat that as an error.
  • Loading branch information
bwelling committed Jun 5, 2024
1 parent 9493345 commit 369a846
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dns/_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def _version_check(
package, minimum = requirement.split(">=")
try:
version = importlib.metadata.version(package)
# This shouldn't happen, but it apparently can.
if version is None:
return False
except Exception:
return False
t_version = _tuple_from_text(version)
Expand Down

0 comments on commit 369a846

Please sign in to comment.