mirror of
https://github.com/zulip/zulip.git
synced 2026-06-15 21:01:31 +08:00
activate_this.py has always documented that it should be exec()ed with
locals = globals, and in virtualenv 16.0.0 it raises a NameError
otherwise.
As a simplified demonstration of the weird things that can go wrong
when locals ≠ globals:
>>> exec('a = 1; print([a])', {}, {})
[1]
>>> exec('a = 1; print([a for b in [1]])', {}, {})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in <module>
File "<string>", line 1, in <listcomp>
NameError: name 'a' is not defined
>>> exec('a = 1; print([a for b in [1]])', {})
[1]
Top-level assignments go into locals, but from inside a new scope like
a list comprehension, they’re read out of globals, which doesn’t work.
Fixes #12030.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
|
||
|---|---|---|
| .. | ||
| __init__.py | ||
| capitalization.py | ||
| find_add_class.py | ||
| gitlint-rules.py | ||
| graph.py | ||
| html_branches.py | ||
| html_grep.py | ||
| pretty_print.py | ||
| provision.py | ||
| sanity_check.py | ||
| template_parser.py | ||
| test_script.py | ||
| test_server.py | ||