Skip to content

Commit e543d69

Browse files
authored
Fix: Fallback logic for when the inspect.stack() call fails (#2617)
1 parent f9c7625 commit e543d69

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sqlmesh/core/analytics/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,13 @@ def wrapper(*args: t.List[t.Any], **kwargs: t.Any) -> t.Any:
8181
from sqlmesh import magics
8282

8383
should_log = True
84-
for frame in inspect.stack():
84+
85+
try:
86+
stack = inspect.stack()
87+
except Exception:
88+
stack = []
89+
90+
for frame in stack:
8591
if "click/" in frame.filename or frame.filename == magics.__file__:
8692
# Magics and CLI are reported separately.
8793
should_log = False

0 commit comments

Comments
 (0)