This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Chun-Yu Tseng
Recipients Chun-Yu Tseng, Jesús Gómez, georg.brandl, xdegaye
Date 2016-11-16.10:53:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1479293617.41.0.21525039006.issue26072@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-11-16 10:53:37Chun-Yu Tsengsetrecipients: + Chun-Yu Tseng, georg.brandl, xdegaye, Jesús Gómez
2016-11-16 10:53:37Chun-Yu Tsengsetmessageid: <1479293617.41.0.21525039006.issue26072@psf.upfronthosting.co.za>
2016-11-16 10:53:37Chun-Yu Tsenglinkissue26072 messages
2016-11-16 10:53:37Chun-Yu Tsengcreate