Package: src:parso Version: 0.8.7-1 User: [email protected] Usertags: python3.15 Tags: patch
Hi! While rebuilding the python related packages against the python version 3.15rc1 we found that parso fails to build from source [1]. Python 3.15 changed some of the texts in the exception messages and parso tests rely on the exact wordings. Upstream already has fixed these issues and I'm attaching the upstream patches that we used in the sandbox. Please consider applying these patches to fix the compatibility with python 3.15. Happy hacking, [1]: https://debusine.debian.net/debian/r-python-python3.15/work-request/1021941/ -- "Can you imagine what I would do if I could do all I can?" -- Sun Tzu Saludos /\/\ /\ >< `/
commit 62b30e7fae5402ead78fdd9315fb3d6e20bce36f Author: Steve Kowalik <[email protected]> Date: Wed Jul 29 20:23:35 2026 +1000 Support Python 3.15 exception message changes (#240) Python 3.15 changed the wording of some SyntaxError exceptions to make it clearer. Closes #239 diff --git a/parso/python/errors.py b/parso/python/errors.py index 09c5047..0916fb3 100644 --- a/parso/python/errors.py +++ b/parso/python/errors.py @@ -973,7 +973,10 @@ class _ParameterRule(SyntaxRule): continue if p.name.value in param_names: - message = "duplicate argument '%s' in function definition" + if sys.version_info[:2] < (3, 15): + message = "duplicate argument '%s' in function definition" + else: + message = "duplicate parameter '%s' in function definition" self.add_issue(p.name, message=message % p.name.value) param_names.add(p.name.value)
commit 512e78c1a8f4968086af652394a9cd0a91c16e54 Author: Steve Kowalik <[email protected]> Date: Thu Jul 30 17:27:07 2026 +1000 Support more Python 3.15 exception changes (#241) Python 3.15 changed the wording of some SyntaxError exceptions to make it clearer. The previous PR only fixed one instance. diff --git a/parso/python/errors.py b/parso/python/errors.py index 0916fb3..c51a36d 100644 --- a/parso/python/errors.py +++ b/parso/python/errors.py @@ -659,7 +659,10 @@ class _StringChecks(SyntaxRule): @ErrorFinder.register_rule(value='*') class _StarCheck(SyntaxRule): - message = "named arguments must follow bare *" + if sys.version_info[:2] < (3, 15): + message = "named arguments must follow bare *" + else: + message = "named parameters must follow bare *" def is_issue(self, leaf): params = leaf.parent diff --git a/test/failing_examples.py b/test/failing_examples.py index a555fde..af0c711 100644 --- a/test/failing_examples.py +++ b/test/failing_examples.py @@ -139,7 +139,6 @@ FAILING_EXAMPLES = [ 'del *a, b', 'def x(*): pass', '(%s *d) = x' % ('a,' * 256), - '{**{} for a in [1]}', '(True,) = x', '([False], a) = x', 'def x(): from math import *', @@ -229,7 +228,6 @@ FAILING_EXAMPLES = [ 'async def foo():\n yield x\n return 1', 'async def foo():\n yield x\n return 1', - '[*[] for a in [1]]', 'async def bla():\n def x(): await bla()', 'del None', 'del True', @@ -423,3 +421,10 @@ if sys.version_info[:2] < (3, 13): FAILING_EXAMPLES += [ 'from .__future__ import whatever', ] + +if sys.version_info[:2] < (3, 15): + # these nested expression successfully evaluate with 3.15 + FAILING_EXAMPLES += [ + '[*[] for a in [1]]', + '{**{} for a in [1]}', + ] diff --git a/test/test_python_errors.py b/test/test_python_errors.py index 0c89016..a3fdaa1 100644 --- a/test/test_python_errors.py +++ b/test/test_python_errors.py @@ -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')

