Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated code is not getting executing if it contains if __name__ == "__main__": #5

Open
aarora79 opened this issue Jan 2, 2025 · 0 comments

Comments

@aarora79
Copy link

aarora79 commented Jan 2, 2025

Often times the generated code by a model contained if name == "main": but none of this code was getting executed because the exec_globals being passed to exec in unsafe_execute was an empty dictionary so the built-in __name__ global variable (like all global variables) did not exist anymore in the namespace for the generated code and hence the main function in the generated code never got called. The main function not getting called resulted in an empty .pred file (the file was created because the file open statement was added separately outside of the generated code's main function) and this resulted in the judge declaring that the answer to the unit test was wrong because it did not match the expected output (because it was comparing the empty prediction file contents with the ground truth file which was not empty). Please see PR #4 for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant