Closed elmer-le-ai closed 5 months ago
@elmer-le Thanks -- that's bad! I think it will be fixable, but I am not certain when I'll get to this.
I just ran into the same issue and tracked it down to being introduced in 0.9.28. Here's another reproduction:
import asteval
a=asteval.Interpreter()
data={'1': 123, '2': 456, '3': 789}
a.symtable['data']=data
print(a("multiplier = {'1': 3, '2': 2, '3': 1};sum([v*multiplier[k] for k, v in data.items()])")) # Returns 8208
multiplier = {'1': 3, '2': 2, '3': 1}
print(sum([v*multiplier[k] for k, v in data.items()])) # Returns 2070
@elmer-le @chrisjbremner These are now fixed in the master branch.
Thanks! Confirmed it worked for my use case. Looking forward to the next release so I can incorporate it!
@chrisjbremner Thanks - I'll close this.
Thanks, do you anticipate a release soon that incorporates this change?
@chrisjbremner Yes, that is on my list, hopefully by the end of the week.
@chrisjbremner 0.9.33 is now released and pushed to PyPI.
I have the following output with 0.9.32:
It seems like unpacking in asteval is taking the cartesian product of
x
andy
.