]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
More error checking in feature detection (#1088)
authorBrian Wellington <bwelling@xbill.org>
Wed, 5 Jun 2024 22:49:28 +0000 (15:49 -0700)
committerBrian Wellington <bwelling@xbill.org>
Wed, 5 Jun 2024 22:52:41 +0000 (15:52 -0700)
importlib.metadata.version() can return None in some cases, even though
it's not documented as doing so.  Treat that as an error.

dns/_features.py

index e5137cbca4601ceb491f5b8d8cec7a58f54621a0..e92beb948d3f947d618fe0c224ec14060ef274c4 100644 (file)
@@ -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)