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

Fix duplicate read when paring python asr #2541

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

syheliel
Copy link
Contributor

fix issue #2475. I create parse_python_source to accept source code literal input to avoid additional file read.

Note that there are still mutiple codes sharing the similar logic, like https://github.com/lcompilers/lpython/blob/main/src/bin/lpython.cpp#L254 . If this modification is accepted, I will fix them in this PR later.

@Thirumalai-Shaktivel
Copy link
Collaborator

What is the status of this PR?

Copy link
Collaborator

@Thirumalai-Shaktivel Thirumalai-Shaktivel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the review and mark this PR as ready for review!

Thank you

Comment on lines +135 to +143
Result<LPython::AST::ast_t*> parse_python_file(Allocator &al,
const std::string &runtime_library_dir,
const std::string &infile,
diag::Diagnostics &diagnostics,
uint32_t prev_loc,
[[maybe_unused]] bool new_parser) {
std::string input_source_code = read_file(infile);
return parse_python_source(al, runtime_library_dir, input_source_code, diagnostics, prev_loc, new_parser);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead, refactor the code to not read in parse_python_file function in parser.cpp.

@Thirumalai-Shaktivel Thirumalai-Shaktivel dismissed their stale review March 5, 2024 12:30

Approved by mistake

@Thirumalai-Shaktivel Thirumalai-Shaktivel marked this pull request as draft March 5, 2024 12:30
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

Successfully merging this pull request may close these issues.

None yet

2 participants