Spaces:
Runtime error
Runtime error
Improved exception error logging
Browse files348 unmodified lines349350351352352353354354355356357358359360361362363364365366367368369370136 unmodified lines5075085095105115125131 unmodified line515516517518519520521348 unmodified lines
if not result: result.append("Result evaluates to False (empty?)") result.append("Result evaluates to False (probably timed out)")
return dict( out_dict = dict( task_id=task_id, passed=result[0] == "passed", result=result[0], completion_id=completion_id, )
if 'failed' in result[0] and len(result) > 1: exc = result[1] out_dict["exception_type"] = type(exc).__name__ out_dict["exception_description"] = str(exc)
return out_dict
class AllowListImporter: def __init__(self, allowed_imports: List[str]):136 unmodified lines with time_limit(timeout): byte_code = compile_restricted(check_program, filename="<model output>", mode="exec", policy=policy_class) exec(byte_code, exec_globals, additional_locals) result.append("passed") except EOFError: result.append("EOF error")1 unmodified line result.append("timed out") except BaseException as e: result.append(f"failed ({type(e)}): {str(e)}") result.append(e)
# Needed for cleaning up. shutil.rmtree = rmtreerestrictedpython_code_eval.py+11-2