diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-09-03 13:06:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-03 13:06:31 (GMT) |
commit | 48941399e388a74ab7f6966c4026ba0f2963fa9c (patch) | |
tree | 511f954f04559f3f15e96dc88849081248b178d7 /Lib/test/test_repl.py | |
parent | d655c655619d8a6b7eec908a7b7c770d5f2ac0f8 (diff) | |
download | cpython-48941399e388a74ab7f6966c4026ba0f2963fa9c.zip cpython-48941399e388a74ab7f6966c4026ba0f2963fa9c.tar.gz cpython-48941399e388a74ab7f6966c4026ba0f2963fa9c.tar.bz2 |
[3.13] gh-121804: always show error location for SyntaxError's in basic repl (GH-123202) (#123631)
gh-121804: always show error location for SyntaxError's in basic repl (GH-123202)
(cherry picked from commit 6822cb23c62032381971d8a47fd41d1e98710a8c)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Diffstat (limited to 'Lib/test/test_repl.py')
-rw-r--r-- | Lib/test/test_repl.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_repl.py b/Lib/test/test_repl.py index 0b93862..363808c 100644 --- a/Lib/test/test_repl.py +++ b/Lib/test/test_repl.py @@ -187,6 +187,19 @@ class TestInteractiveInterpreter(unittest.TestCase): ] self.assertEqual(traceback_lines, expected_lines) + def test_runsource_show_syntax_error_location(self): + user_input = dedent("""def f(x, x): ... + """) + p = spawn_repl() + p.stdin.write(user_input) + output = kill_python(p) + expected_lines = [ + ' def f(x, x): ...', + ' ^', + "SyntaxError: duplicate argument 'x' in function definition" + ] + self.assertEqual(output.splitlines()[4:-1], expected_lines) + def test_interactive_source_is_in_linecache(self): user_input = dedent(""" def foo(x): |