Message280933
The last patch in #21161 fixes some problems but also brings up critical issues:
(Pdb) list .
1 y = 2
2
3 def f():
4 y = 9
5 z = 10
6 -> import pdb; pdb.set_trace();
7 f()
[EOF]
(Pdb) globals()['y']
9
(Pdb) global y; print(y)
9
(Pdb) globals()['z']
10
I think that we should not copy local variables to globals() while doing execution. It will always bring out the wrong result of `globals()`.
So, the patch I proposed here is focused on "Showing Friendly Error Message" to let the users be less confused.
# The patch works when a user tries to bound a free variable to a list comprehension. It will show the proper error message, too. |
|
Date |
User |
Action |
Args |
2016-11-16 10:53:37 | Chun-Yu Tseng | set | recipients:
+ Chun-Yu Tseng, georg.brandl, xdegaye, Jesús Gómez |
2016-11-16 10:53:37 | Chun-Yu Tseng | set | messageid: <1479293617.41.0.21525039006.issue26072@psf.upfronthosting.co.za> |
2016-11-16 10:53:37 | Chun-Yu Tseng | link | issue26072 messages |
2016-11-16 10:53:37 | Chun-Yu Tseng | create | |
|