Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1ff96cf

Browse files
authored
Merge pull requestalexmojaki#169 from alexmojaki/interrupt
Cancel checking step completely after KeyboardInterrupt
2 parentsca463b4 +bee8e0e commit1ff96cf

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

‎core/chapters/c11_tic_tac_toe_project.py‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,11 +1251,6 @@ def program(self):
12511251
name=input()
12521252
print(f'Hello{name}!')
12531253

1254-
defcheck(self):
1255-
ifKeyboardInterrupt.__name__inself.result:
1256-
returnFalse
1257-
returnsuper().check()
1258-
12591254
classconvert_input_to_int(ExerciseStep):
12601255
"""
12611256
Whatever you typed in (not including pressing Enter at the end) is returned from the `input()` function as a string.

‎core/workers/worker.py‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
defexecute(code_obj):
2323
try:
2424
exec(code_obj,console.locals)
25-
except (Exception,KeyboardInterrupt)ase:
25+
exceptKeyboardInterrupt:
26+
raise
27+
exceptExceptionase:
2628
returnTracebackSerializer().format_exception(e)
2729

2830

@@ -92,7 +94,16 @@ def check_entry(entry, input_callback, result_callback):
9294
patch_stdin(input_callback,result_callback)
9395

9496
withredirect_stdout(output_buffer.stdout),redirect_stderr(output_buffer.stderr):
95-
run_results=run_code(entry["source"],entry["input"])
97+
try:
98+
run_results=run_code(entry["source"],entry["input"])
99+
exceptKeyboardInterrupt:
100+
result_callback(
101+
make_result(
102+
output='',
103+
output_parts=[],
104+
)
105+
)
106+
return
96107

97108
output=output_buffer.string()
98109

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp