Spaces:
Sleeping
Sleeping
Catching an error better
Browse files
restrictedpython_code_eval.py
CHANGED
@@ -245,10 +245,13 @@ def _check_correctness(check_program, timeout, task_id, completion_id,
|
|
245 |
additional_globals, additional_locals, allowed_imports
|
246 |
)
|
247 |
p = multiprocessing.Process(target=_unsafe_execute, args=args)
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
p.
|
|
|
|
|
|
|
252 |
|
253 |
if not result:
|
254 |
result.append("timed out")
|
|
|
245 |
additional_globals, additional_locals, allowed_imports
|
246 |
)
|
247 |
p = multiprocessing.Process(target=_unsafe_execute, args=args)
|
248 |
+
try:
|
249 |
+
p.start()
|
250 |
+
p.join(timeout=timeout + 1)
|
251 |
+
if p.is_alive():
|
252 |
+
p.kill()
|
253 |
+
except EOFError as e:
|
254 |
+
result.append(f"EOFError: {e}")
|
255 |
|
256 |
if not result:
|
257 |
result.append("timed out")
|