-
Notifications
You must be signed in to change notification settings - Fork 157
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
Python file read twice ? #2475
Comments
I also see a read_file on line 197 of lpython.cpp. I'm still learning what's going on. |
The file should only be read once. If it is read twice, that's a bug that we need to fix. There are many file reads, but only one should be executed. |
Looks like, during parsing, read_file is called at least twice, once to parse and once to I set breakpoints on every one of these lines:
then I ran |
If so, we need to fix it. |
marking |
I write a gdb script to have a dig into the problem. It will record the call stack when
In logging file, The
Maybe we can cache the read_file's result in a unordered_map<string,string>, and return the file content if the |
Let's refactor the frontend to only call the read function once. I wonder what is going on. |
Ok, let me explore the frontend's execution flow and try to figure out the root cause |
repro:
lldb lpython -- --show-asr tests/expr8.py
first time it's read is line 128 of lpython.cpp
second time it's read is line 125 of parser.cpp
intentional?
The text was updated successfully, but these errors were encountered: