Support more Python 3.15 exception changes (#241)
Build / lint (push) Canceled after 0s
Build / test (false, 3.10) (push) Canceled after 0s
Build / test (false, 3.11) (push) Canceled after 0s
Build / test (false, 3.12) (push) Canceled after 0s
Build / test (false, 3.13) (push) Canceled after 0s
Build / test (false, 3.8) (push) Canceled after 0s
Build / test (false, 3.9) (push) Canceled after 0s
Build / coverage (push) Canceled after 0s

Python 3.15 changed the wording of some SyntaxError exceptions to make
it clearer. The previous PR only fixed one instance.
This commit is contained in:
Steve Kowalik authored and GitHub committed 2026-07-30 07:27:07 +00:00
1 parent 62b30e7fae
commit 512e78c1a8
3 files changed
+17 -5

No files matched your search

+6 -2
View File
@@ -275,9 +275,13 @@ def test_named_argument_issues(works_not_in_py):
message = works_not_in_py.get_error_message('def foo(*, **dict): pass')
message = works_not_in_py.get_error_message('def foo(*): pass')
if works_not_in_py.version.startswith('2'):
assert message == 'SyntaxError: invalid syntax'
wanted = 'SyntaxError: invalid syntax'
else:
assert message == 'SyntaxError: named arguments must follow bare *'
if sys.version_info[:2] < (3, 15):
wanted = 'SyntaxError: named arguments must follow bare *'
else:
wanted = 'SyntaxError: named parameters must follow bare *'
assert message == wanted
works_not_in_py.assert_no_error_in_passing('def foo(*, name): pass')
works_not_in_py.assert_no_error_in_passing('def foo(bar, *, name=1): pass')