From f2ec1e189671d04197fc80122a3be54176eecf18 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Fri, 3 Jan 2025 16:22:01 -0800 Subject: [PATCH] Add check before iterate over dist.requires --- .../opentelemetry/instrumentation/dependencies.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py index 8f0a383412..b7e4cff400 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py @@ -47,13 +47,14 @@ def get_dist_dependency_conflicts( extra = "extra" instruments = "instruments" instruments_marker = {extra: instruments} - for dep in dist.requires: - if extra not in dep or instruments not in dep: - continue - - req = Requirement(dep) - if req.marker.evaluate(instruments_marker): - instrumentation_deps.append(req) + if dist.requires: + for dep in dist.requires: + if extra not in dep or instruments not in dep: + continue + + req = Requirement(dep) + if req.marker.evaluate(instruments_marker): + instrumentation_deps.append(req) return get_dependency_conflicts(instrumentation_deps)