mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-24 17:05:03 +00:00
don't pass answer value to eval
This commit is contained in:
parent
d6aad5a329
commit
1511c5e301
1 changed files with 3 additions and 3 deletions
|
|
@ -117,10 +117,10 @@ Please follow the instruction below:
|
|||
try:
|
||||
# Try to parse the user's answer as a JSON list first
|
||||
try:
|
||||
answer = answer.replace("'", '"')
|
||||
user_answer = json.loads(answer)
|
||||
except json.JSONDecodeError:
|
||||
# If JSON parsing fails, fall back to eval (with caution)
|
||||
user_answer = eval(answer)
|
||||
return 0.0 # JSON parsing failed
|
||||
|
||||
if not isinstance(user_answer, list):
|
||||
return 0.0
|
||||
|
|
@ -159,7 +159,7 @@ Please follow the instruction below:
|
|||
return 0.0
|
||||
|
||||
return 1.0
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
# Any parsing error means the answer is incorrect
|
||||
return 0.0
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue