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 Robert Haschke
Recipients Robert Haschke
Date 2020-09-29.04:46:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1601354771.67.0.486953895644.issue41878@roundup.psfhosted.org>
In-reply-to
Content
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 one, passing dict as global symbols, works:

eval('[abc[i]*abc[i] for i in [0, 1, 2]]', dict(abc=[1, 2, 3]))

However, passing globals must be a real dict. So I cannot simply pass my custom mapping to globals.
History
Date User Action Args
2020-09-29 04:46:11Robert Haschkesetrecipients: + Robert Haschke
2020-09-29 04:46:11Robert Haschkesetmessageid: <1601354771.67.0.486953895644.issue41878@roundup.psfhosted.org>
2020-09-29 04:46:11Robert Haschkelinkissue41878 messages
2020-09-29 04:46:11Robert Haschkecreate