From: Brian Wellington Date: Wed, 5 Jun 2024 22:49:28 +0000 (-0700) Subject: More error checking in feature detection (#1088) X-Git-Tag: v2.7.0rc1~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=369a846766fd50017d8fb28da930b83782da881c;p=thirdparty%2Fdnspython.git More error checking in feature detection (#1088) importlib.metadata.version() can return None in some cases, even though it's not documented as doing so. Treat that as an error. --- diff --git a/dns/_features.py b/dns/_features.py index e5137cbc..e92beb94 100644 --- a/dns/_features.py +++ b/dns/_features.py @@ -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)