From ecdb381f6bd5d8d4cc8b9120f09677bb4f76702c Mon Sep 17 00:00:00 2001 From: Guillaume Bouvignies Date: Thu, 21 Dec 2023 10:26:13 +0100 Subject: [PATCH] fix: Python wrapper catches BaseException instead of Exception (#2902) --- backend/windmill-worker/src/python_executor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/windmill-worker/src/python_executor.rs b/backend/windmill-worker/src/python_executor.rs index f971988fd6..19d686055b 100644 --- a/backend/windmill-worker/src/python_executor.rs +++ b/backend/windmill-worker/src/python_executor.rs @@ -261,7 +261,7 @@ try: res_json = re.sub(replace_nan, ' null ', json.dumps(res, separators=(',', ':'), default=str).replace('\n', '')) with open("result.json", 'w') as f: f.write(res_json) -except Exception as e: +except BaseException as e: exc_type, exc_value, exc_traceback = sys.exc_info() tb = traceback.format_tb(exc_traceback) with open("result.json", 'w') as f: @@ -926,7 +926,7 @@ for line in sys.stdin: res[k] = to_b_64(v) res_json = re.sub(replace_nan, ' null ', json.dumps(res, separators=(',', ':'), default=str).replace('\n', '')) sys.stdout.write("wm_res:" + res_json + "\n") - except Exception as e: + except BaseException as e: exc_type, exc_value, exc_traceback = sys.exc_info() tb = traceback.format_tb(exc_traceback) err_json = json.dumps({{ "error": {{ "message": str(e), "name": e.__class__.__name__, "stack": '\n'.join(tb[1:]) }} }}, separators=(',', ':'), default=str).replace('\n', '')