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 alex0kamp
Recipients alex0kamp, qpeter
Date 2020-11-13.11:43:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1605267799.23.0.629607174617.issue41918@roundup.psfhosted.org>
In-reply-to
Content
This seems to happen only when both arguments to exec are used:

```
Python 3.7.7 (default, Mar 10 2020, 15:43:27)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exec('text = ["hallo"]\ntext.append("Welt")\nprint(" ".join([text[i] for i in range(0, 2)]))')
hallo Welt
>>> exec('text = ["hallo"]\ntext.append("Welt")\nprint(" ".join([text[i] for i in range(0, 2)]))', {})
hallo Welt
>>> exec('text = ["hallo"]\ntext.append("Welt")\nprint(" ".join(text))', {}, {})
hallo Welt
>>> exec('text = ["hallo"]\ntext.append("Welt")\nprint(" ".join([text[i] for i in range(0, 2)]))', {}, {})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 3, in <module>
  File "<string>", line 3, in <listcomp>
NameError: name 'text' is not defined
```
History
Date User Action Args
2020-11-13 11:43:19alex0kampsetrecipients: + alex0kamp, qpeter
2020-11-13 11:43:19alex0kampsetmessageid: <1605267799.23.0.629607174617.issue41918@roundup.psfhosted.org>
2020-11-13 11:43:19alex0kamplinkissue41918 messages
2020-11-13 11:43:19alex0kampcreate