Dont expect __qualname__ to exist (#41989)

This commit is contained in:
Harmen Stoppels 2024-01-08 16:41:56 +01:00
parent 68e9547615
commit 0295b466d7

View file

@ -1333,7 +1333,7 @@ def make_stack(tb, stack=None):
# don't provide context if the code is actually in the base classes. # don't provide context if the code is actually in the base classes.
obj = frame.f_locals["self"] obj = frame.f_locals["self"]
func = getattr(obj, tb.tb_frame.f_code.co_name, "") func = getattr(obj, tb.tb_frame.f_code.co_name, "")
if func: if func and hasattr(func, "__qualname__"):
typename, *_ = func.__qualname__.partition(".") typename, *_ = func.__qualname__.partition(".")
if isinstance(obj, CONTEXT_BASES) and typename not in basenames: if isinstance(obj, CONTEXT_BASES) and typename not in basenames:
break break