From 8adcd7d7b5cee93048af8353771e585907225e4c Mon Sep 17 00:00:00 2001 From: Kenichi Maehashi Date: Tue, 25 Feb 2025 21:51:13 +0900 Subject: [PATCH] Merge pull request #8982 from kmaehashi/fix-exec-local Pass `locals` dict to `exec` --- tests/typing_tests/test_run.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/typing_tests/test_run.py b/tests/typing_tests/test_run.py index 87541602211..de507b74dac 100644 --- a/tests/typing_tests/test_run.py +++ b/tests/typing_tests/test_run.py @@ -10,10 +10,11 @@ def test_run(t: Path) -> None: with open(t) as f: lines = f.readlines() + exec_locals = {} for _lineno, _line in enumerate(lines, start=1): if "# E: " not in _line: try: - exec(_line) + exec(_line, None, exec_locals) except Exception: print(f"{t}:{_lineno} {_line}") raise