diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 8d5a1ec8df..2e144fc80f 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -2535,8 +2535,9 @@ def patches(self): # if not found in this package, check immediate dependents # for dependency patches - for dep in self._dependents: - patch = dep.parent.package.lookup_patch(sha256) + for dep_spec in self._dependents.values(): + patch = dep_spec.parent.package.lookup_patch(sha256) + if patch: patches.append(patch)