From 0295b466d7e355e89d754175d146c1168e66c119 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Mon, 8 Jan 2024 16:41:56 +0100 Subject: [PATCH] Dont expect __qualname__ to exist (#41989) --- lib/spack/spack/build_environment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 20d8e75f9b..5028886a98 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -1333,7 +1333,7 @@ def make_stack(tb, stack=None): # don't provide context if the code is actually in the base classes. obj = frame.f_locals["self"] func = getattr(obj, tb.tb_frame.f_code.co_name, "") - if func: + if func and hasattr(func, "__qualname__"): typename, *_ = func.__qualname__.partition(".") if isinstance(obj, CONTEXT_BASES) and typename not in basenames: break