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

Duplicated NameError in 1.0.2? #132

Closed
ns-rorsten opened this issue Aug 28, 2024 · 4 comments
Closed

Duplicated NameError in 1.0.2? #132

ns-rorsten opened this issue Aug 28, 2024 · 4 comments

Comments

@ns-rorsten
Copy link

In a project using asteval, a test that creates a NameError started failing with a doubled error count when I upgraded to 1.0.2. I see this addressed a problem with NameError handling, but:

In [1]: import asteval

In [2]: interpreter = asteval.Interpreter(nested_symtable=False, use_numpy=False)

In [3]: interpreter.run("print(hi)", with_raise=False)

In [4]: print([e.get_error() for e in interpreter.error])
[('NameError', "   print(hi)\n          ^^^^\nNameError: name 'hi' is not defined"), ('NameError', "   print(hi)\n          ^^^^\nNameError: name 'hi' is not defined")]

For comparison, after downgrading to 1.0.1:

In [1]: import asteval

In [2]: interpreter = asteval.Interpreter(nested_symtable=False, use_numpy=False)

In [3]: interpreter.run("print(hi)", with_raise=False)

In [4]: print([e.get_error() for e in interpreter.error])
[('NameError', "   print(hi)\n          ^^^\nname 'hi' is not defined")]
@newville
Copy link
Member

@ns-rorsten Hm, I'll say both "I'm not sure why that is", and "well, better twice than never". ;).

I'll look in to it.

@newville
Copy link
Member

newville commented Sep 7, 2024

@ns-rorsten I think this is now fixed in the master development branch. Once tests all pass, I'll tag a new release.

@ns-rorsten
Copy link
Author

Excellent, thank you for the quick response.

@newville
Copy link
Member

@ns-rorsten This should now be fixed.

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

2 participants