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

Infinte loop occur in REPL #174

Closed
GreasySlug opened this issue Sep 22, 2022 · 0 comments · Fixed by #175
Closed

Infinte loop occur in REPL #174

GreasySlug opened this issue Sep 22, 2022 · 0 comments · Fixed by #175
Labels
bug Something isn't working

Comments

@GreasySlug
Copy link
Member

Describe the bug

When any input is made in REPL mode, an infinite loop is occurred.

Reproducible code

cargo run
Starting the REPL server...
Connecting to the REPL server...
Erg interpreter 0.5.0-beta.0 (tags/?:5c5ea55, 2022/09/22 17:15:05.16) on x86_64/windows
>>> a # infinite loop occur

Additional context

I have already identified the location of the cause and the following code is the culprit.

erg/src/dummy.rs

Lines 104 to 107 in b56236a

fn eval(&mut self, src: String) -> Result<String, EvalErrors> {
self.compiler.cfg.input = Input::Str(src);
self.compiler.compile_and_dump_as_pyc("o.pyc", "eval")?;
let mut res = match self.stream.as_mut().unwrap().write("load".as_bytes()) {

Without avoiding the assignment of Input::Str(src) to self.compiler.cfg.input, this will result in an infinite loop.

@GreasySlug GreasySlug added the bug Something isn't working label Sep 22, 2022
@mtshiba mtshiba mentioned this issue Sep 22, 2022
mtshiba added a commit that referenced this issue Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant