[issue38331] Exec not recognizing global variables inside function

2019-10-02 Thread Huyston
Huyston added the comment: Ronald Oussoren, I understand your comment and it makes sense in the module perspective. However, when using 'exec', we are explicitly passing a globals dict (and locals) that the target code should consider. As the documentation states: "If globals and l

[issue38331] Exec not recognizing global variables inside function

2019-09-30 Thread Huyston
New submission from Huyston : This seems like a bug for me, forgive me if its not. Consider the following script: def func(): print(var) my_globals = {'func':func,'var':14} exec("print(var);func()",my_globals,my_globals) This is the output: 14 Traceback (most recent call las