Skip to content

Commit 3c975e2

Browse files
committed
KeyboardInterruptが予期せぬエラーになるのを修正
1 parent c5d79eb commit 3c975e2

2 files changed

Lines changed: 1 addition & 5 deletions

File tree

packages/runtime/src/worker/pyodide/eval_code.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ async def __eval_code(code):
1111
"result": str(result) if result is not None else None,
1212
"has_return": result is not None,
1313
})
14-
except (KeyboardInterrupt, SystemExit, GeneratorExit):
15-
raise
1614
except BaseException as e:
1715
tb = e.__traceback__
1816
entries = traceback.extract_tb(tb)

packages/runtime/src/worker/pyodide/execfile.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ def __execfile(filepath):
1515
code_obj = compile(code_bytes, filepath, "exec")
1616
exec(code_obj, exec_globals)
1717
return json.dumps({"success": True})
18-
except (KeyboardInterrupt, SystemExit, GeneratorExit):
19-
raise
2018
except BaseException as e:
2119
frames = []
2220
if isinstance(e, SyntaxError):
@@ -77,7 +75,7 @@ def __execfile(filepath):
7775
formatted_tb = "".join(traceback.format_exception(type(e), e, None)).strip()
7876

7977
diagnostic = None
80-
if frames:
78+
if frames and not isinstance(e, (KeyboardInterrupt, SystemExit)):
8179
diagnostic = {
8280
"frames": frames,
8381
"message": error_message,

0 commit comments

Comments
 (0)