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 r.david.murray
Recipients Peter Eastman, r.david.murray
Date 2015-08-05.19:58:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1438804698.33.0.705160061364.issue24800@psf.upfronthosting.co.za>
In-reply-to
Content
exec is subtle.  See the explanation linked from issue 23087, which while not *exactly* on point explains the underlying problem (a comprehension is a new scope, and exec can't reach an intermediate scope the way a compiled function can).

As far as the difference from 2.7 goes, the scoping rules for comprehensions changed in python3: the variable you are concerned with is now part of the local scope.
History
Date User Action Args
2015-08-05 19:58:18r.david.murraysetrecipients: + r.david.murray, Peter Eastman
2015-08-05 19:58:18r.david.murraysetmessageid: <1438804698.33.0.705160061364.issue24800@psf.upfronthosting.co.za>
2015-08-05 19:58:18r.david.murraylinkissue24800 messages
2015-08-05 19:58:17r.david.murraycreate