kkpyutil 1.44.0__tar.gz → 1.45.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kkpyutil-1.44.0 → kkpyutil-1.45.0}/PKG-INFO +1 -1
- {kkpyutil-1.44.0 → kkpyutil-1.45.0}/kkpyutil.py +18 -0
- {kkpyutil-1.44.0 → kkpyutil-1.45.0}/pyproject.toml +1 -1
- {kkpyutil-1.44.0 → kkpyutil-1.45.0}/LICENSE +0 -0
- {kkpyutil-1.44.0 → kkpyutil-1.45.0}/README.md +0 -0
- {kkpyutil-1.44.0 → kkpyutil-1.45.0}/kkpyutil_helper/windows/kkttssave.ps1 +0 -0
- {kkpyutil-1.44.0 → kkpyutil-1.45.0}/kkpyutil_helper/windows/kkttsspeak.ps1 +0 -0
|
@@ -667,6 +667,24 @@ def format_xml(elem, indent=' ', encoding='utf-8'):
|
|
|
667
667
|
return '\n'.join(non_empty_lines)
|
|
668
668
|
|
|
669
669
|
|
|
670
|
+
def format_callstack():
|
|
671
|
+
"""
|
|
672
|
+
- traceback in worker thread is hard to propagate to main thread
|
|
673
|
+
- so we wrap around inspect.stack() before passing it
|
|
674
|
+
"""
|
|
675
|
+
import inspect
|
|
676
|
+
stack = inspect.stack()
|
|
677
|
+
formatted_stack = []
|
|
678
|
+
for frame_info in reversed(stack): # Reverse to match traceback's order
|
|
679
|
+
filename = frame_info.filename
|
|
680
|
+
lineno = frame_info.lineno
|
|
681
|
+
function = frame_info.function
|
|
682
|
+
code_context = frame_info.code_context[0].strip() if frame_info.code_context else ''
|
|
683
|
+
# Format each frame like traceback
|
|
684
|
+
formatted_stack.append(f' File "{filename}", line {lineno}, in {function}\n {code_context}\n')
|
|
685
|
+
return ''.join(formatted_stack)
|
|
686
|
+
|
|
687
|
+
|
|
670
688
|
def throw(err_cls, detail, advice):
|
|
671
689
|
raise err_cls(f"""
|
|
672
690
|
{format_brief('Detail', detail if isinstance(detail, list) else [detail])}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|