asteval icon indicating copy to clipboard operation
asteval copied to clipboard

Duplicated NameError in 1.0.2?

Open ns-rorsten opened this issue 6 months ago • 1 comments

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")]

ns-rorsten avatar Aug 28 '24 18:08 ns-rorsten