[issue41878] python3 fails to use custom mapping object as symbols in eval()

2020-11-24 Thread Josh Rosenberg
Change by Josh Rosenberg : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue41878] python3 fails to use custom mapping object as symbols in eval()

2020-10-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: Robert, this tracker is for patching CPython, not for debugging user code. If, as it appears, you are not suggesting the former, please close this. For the latter, python-list and stackoverflow.com are appropriate forums. -- nosy: +terry.reedy

[issue41878] python3 fails to use custom mapping object as symbols in eval()

2020-09-29 Thread Robert Haschke
Robert Haschke added the comment: Thanks, Josh, for this clarification. What is the suggested mitigation? Obviously, I need to pass all symbols from my hierarchical dictionary in a flattend version as a dict to globals. Or do you see another option? --

[issue41878] python3 fails to use custom mapping object as symbols in eval()

2020-09-29 Thread Josh Rosenberg
Josh Rosenberg added the comment: Yes, list comprehensions having their own local scope was a change from Py2 to Py3. Python 2 did not do this for list comps initially, and it was left that way during the 2.x timeframe due to back compat constraints, but 2.x did it from the start for

[issue41878] python3 fails to use custom mapping object as symbols in eval()

2020-09-28 Thread Robert Haschke
Robert Haschke added the comment: Looks like the list generator is considered as a new nested scope, which prohibits access to local variables? This basic expression, passing local symbols only, fails as well: eval('[abc[i]*abc[i] for i in [0, 1, 2]]', {}, dict(abc=[1, 2, 3])) while this