On Thu, Nov 21, 2024 at 10:09:12AM +0000, Julian Gilbey wrote: > Hello Piotr, > > On Thu, Oct 10, 2024 at 07:04:25PM -0700, Stefano Rivera wrote: > > Source: parso > > Version: 0.8.3-1 > > Severity: normal > > User: debian-pyt...@lists.debian.org > > Usertags: python3.13 > > Affects: -1 src:pandas > > > > Please update to 0.8.4 that includes the grammar for Python 3.13. > > > > Pandas fails to run its test suite under 3.13, due to missing parso > > grammar: > > [...] > > I've just uploaded an NMU 0.8.4-0.1 to DELAYED/7-days fixing both of > these RC bugs. Attached is a diff of the debian/ directory between > 0.8.3-1 and this new version (but not including the changes to > upstream); the diff is quite large, as there were lots of tests newly > failing in Python 3.12/3.13. The old patch for Python 3.10 has > already been incorporated upstream. The only other change I've made > is to include Testsuite: autopkgtest-pkg-pybuild.
Oops, forgot the attachment! Best wishes, Julian
diff -Nru parso-0.8.3/debian/changelog parso-0.8.4/debian/changelog --- parso-0.8.3/debian/changelog 2022-12-04 14:37:09.000000000 +0000 +++ parso-0.8.4/debian/changelog 2024-11-21 09:59:11.136078389 +0000 @@ -1,3 +1,10 @@ +parso (0.8.4-0.1) unstable; urgency=medium + + * Non-maintainer upload + * New upstream release, supports Python 3.13 (closes: #1052800, #1084912) + + -- Julian Gilbey <j...@debian.org> Thu, 21 Nov 2024 09:59:03 +0000 + parso (0.8.3-1) unstable; urgency=medium [ Jochen Sprickerhof ] diff -Nru parso-0.8.3/debian/control parso-0.8.4/debian/control --- parso-0.8.3/debian/control 2022-12-04 14:36:05.000000000 +0000 +++ parso-0.8.4/debian/control 2024-11-20 22:51:50.693762067 +0000 @@ -13,6 +13,7 @@ Standards-Version: 4.6.1 Rules-Requires-Root: no Homepage: https://github.com/davidhalter/parso +Testsuite: autopkgtest-pkg-pybuild Package: python3-parso Architecture: all diff -Nru parso-0.8.3/debian/patches/0002-Fix-unit-tests-in-Python-3.10.patch parso-0.8.4/debian/patches/0002-Fix-unit-tests-in-Python-3.10.patch --- parso-0.8.3/debian/patches/0002-Fix-unit-tests-in-Python-3.10.patch 2022-12-04 14:33:23.000000000 +0000 +++ parso-0.8.4/debian/patches/0002-Fix-unit-tests-in-Python-3.10.patch 1970-01-01 01:00:00.000000000 +0100 @@ -1,139 +0,0 @@ -From 091149f84e4aed1b24e89d1340ce90a76c5bc46d Mon Sep 17 00:00:00 2001 -From: Jochen Sprickerhof <g...@jochen.sprickerhof.de> -Date: Sun, 4 Dec 2022 13:29:25 +0100 -Subject: [PATCH] Fix unit tests in Python 3.10 - ---- - parso/python/errors.py | 20 ++++++++++---------- - test/test_python_errors.py | 15 +++++++++++++++ - 2 files changed, 25 insertions(+), 10 deletions(-) - -diff --git a/parso/python/errors.py b/parso/python/errors.py -index 5da046a..10f08e5 100644 ---- a/parso/python/errors.py -+++ b/parso/python/errors.py -@@ -33,7 +33,7 @@ def _get_rhs_name(node, version): - return "literal" - else: - if second.children[1] == ":" or second.children[0] == "**": -- return "dict display" -+ return "dict literal" - else: - return "set display" - elif ( -@@ -47,7 +47,7 @@ def _get_rhs_name(node, version): - elif first == "[": - return "list" - elif first == "{" and second == "}": -- return "dict display" -+ return "dict literal" - elif first == "{" and len(node.children) > 2: - return "set display" - elif type_ == "keyword": -@@ -58,7 +58,7 @@ def _get_rhs_name(node, version): - else: - return str(node.value) - elif type_ == "operator" and node.value == "...": -- return "Ellipsis" -+ return "ellipsis" - elif type_ == "comparison": - return "comparison" - elif type_ in ("string", "number", "strings"): -@@ -83,7 +83,7 @@ def _get_rhs_name(node, version): - or "_test" in type_ - or type_ in ("term", "factor") - ): -- return "operator" -+ return "expression" - elif type_ == "star_expr": - return "starred" - elif type_ == "testlist_star_expr": -@@ -610,7 +610,7 @@ class _NameChecks(SyntaxRule): - - @ErrorFinder.register_rule(type='string') - class _StringChecks(SyntaxRule): -- message = "bytes can only contain ASCII literal characters." -+ message = "bytes can only contain ASCII literal characters" - - def is_issue(self, leaf): - string_prefix = leaf.string_prefix.lower() -@@ -1043,14 +1043,14 @@ class _CheckAssignmentRule(SyntaxRule): - error = 'literal' - else: - if second.children[1] == ':': -- error = 'dict display' -+ error = 'dict literal' - else: - error = 'set display' - elif first == "{" and second == "}": - if self._normalizer.version < (3, 8): - error = 'literal' - else: -- error = "dict display" -+ error = "dict literal" - elif first == "{" and len(node.children) > 2: - if self._normalizer.version < (3, 8): - error = 'literal' -@@ -1083,7 +1083,7 @@ class _CheckAssignmentRule(SyntaxRule): - error = str(node.value) - elif type_ == 'operator': - if node.value == '...': -- error = 'Ellipsis' -+ error = 'ellipsis' - elif type_ == 'comparison': - error = 'comparison' - elif type_ in ('string', 'number', 'strings'): -@@ -1098,7 +1098,7 @@ class _CheckAssignmentRule(SyntaxRule): - if node.children[0] == 'await': - error = 'await expression' - elif node.children[-2] == '**': -- error = 'operator' -+ error = 'expression' - else: - # Has a trailer - trailer = node.children[-1] -@@ -1120,7 +1120,7 @@ class _CheckAssignmentRule(SyntaxRule): - elif ('expr' in type_ and type_ != 'star_expr' # is a substring - or '_test' in type_ - or type_ in ('term', 'factor')): -- error = 'operator' -+ error = 'expression' - elif type_ == "star_expr": - if is_deletion: - if self._normalizer.version >= (3, 9): -diff --git a/test/test_python_errors.py b/test/test_python_errors.py -index adf5f06..7ee1064 100644 ---- a/test/test_python_errors.py -+++ b/test/test_python_errors.py -@@ -1,6 +1,7 @@ - """ - Testing if parso finds syntax errors and indentation errors. - """ -+import re - import sys - import warnings - -@@ -136,6 +137,20 @@ def _get_actual_exception(code): - wanted = 'SyntaxError: invalid syntax' - elif wanted == "SyntaxError: f-string: single '}' is not allowed": - wanted = 'SyntaxError: invalid syntax' -+ elif "Maybe you meant '==' instead of '='?" in wanted: -+ wanted = wanted.removesuffix(" here. Maybe you meant '==' instead of '='?") -+ elif re.match(r'SyntaxError: unterminated string literal \(detected at line \d+\)', wanted): -+ wanted = 'SyntaxError: EOL while scanning string literal' -+ elif re.match(r'SyntaxError: unterminated triple-quoted string literal \(detected at line \d+\)', wanted): -+ wanted = 'SyntaxError: EOF while scanning triple-quoted string literal' -+ elif wanted == 'SyntaxError: cannot use starred expression here': -+ wanted = "SyntaxError: can't use starred expression here" -+ elif wanted == 'SyntaxError: f-string: cannot use starred expression here': -+ wanted = "SyntaxError: f-string: can't use starred expression here" -+ elif re.match(r"IndentationError: expected an indented block after '[^']*' statement on line \d", wanted): -+ wanted = 'IndentationError: expected an indented block' -+ elif wanted == 'SyntaxError: unterminated string literal': -+ wanted = 'SyntaxError: EOL while scanning string literal' - return [wanted], line_nr - - --- -2.38.1 - diff -Nru parso-0.8.3/debian/patches/python3.13-fixes.patch parso-0.8.4/debian/patches/python3.13-fixes.patch --- parso-0.8.3/debian/patches/python3.13-fixes.patch 1970-01-01 01:00:00.000000000 +0100 +++ parso-0.8.4/debian/patches/python3.13-fixes.patch 2024-11-21 09:58:46.684392549 +0000 @@ -0,0 +1,150 @@ +Description: Handle different error messages in Python 3.12 and 3.13 +Forwarded: https://github.com/davidhalter/parso/pull/227 +Author: Julian Gilbey <j...@debian.org> +Last-Update: 2024-11-21 + + +--- a/test/failing_examples.py ++++ b/test/failing_examples.py +@@ -227,8 +227,6 @@ + "f'{1;1}'", + "f'{a;}'", + "f'{b\"\" \"\"}'", +- # f-string expression part cannot include a backslash +- r'''f"{'\n'}"''', + + 'async def foo():\n yield x\n return 1', + 'async def foo():\n yield x\n return 1', +--- a/test/test_python_errors.py ++++ b/test/test_python_errors.py +@@ -105,7 +105,7 @@ + # It's as simple as either an error or not. + warnings.filterwarnings('ignore', category=SyntaxWarning) + try: +- compile(code, '<unknown>', 'exec') ++ compiled = compile(code, '<unknown>', 'exec') + except (SyntaxError, IndentationError) as e: + wanted = e.__class__.__name__ + ': ' + e.msg + line_nr = e.lineno +@@ -115,28 +115,73 @@ + wanted = 'SyntaxError: (value error) ' + str(e) + line_nr = None + else: +- assert False, "The piece of code should raise an exception." ++ # In Python 3.12+, some invalid f-strings compile OK but ++ # only raise an exception when they are evaluated. ++ try: ++ eval(compiled) ++ except ValueError as e: ++ wanted = 'SyntaxError: (value error) ' + str(e) ++ line_nr = None ++ except (ImportError, ModuleNotFoundError): ++ # This comes from 'from .__future__ import whatever' ++ # in Python 3.13+ ++ wanted = 'SyntaxError: future feature whatever is not defined' ++ line_nr = None ++ else: ++ assert False, "The piece of code should raise an exception." + + # SyntaxError +- if wanted == 'SyntaxError: assignment to keyword': ++ # Some errors have changed error message in later versions of Python, ++ # and we give a translation table here. We deal with special cases ++ # below. ++ translations = { ++ 'SyntaxError: f-string: unterminated string': ++ 'SyntaxError: EOL while scanning string literal', ++ "SyntaxError: f-string: expecting '}'": ++ 'SyntaxError: EOL while scanning string literal', ++ 'SyntaxError: f-string: empty expression not allowed': ++ 'SyntaxError: invalid syntax', ++ "SyntaxError: f-string expression part cannot include '#'": ++ 'SyntaxError: invalid syntax', ++ "SyntaxError: f-string: single '}' is not allowed": ++ 'SyntaxError: invalid syntax', ++ 'SyntaxError: cannot use starred expression here': ++ "SyntaxError: can't use starred expression here", ++ 'SyntaxError: f-string: cannot use starred expression here': ++ "SyntaxError: f-string: can't use starred expression here", ++ 'SyntaxError: unterminated string literal': ++ 'SyntaxError: EOL while scanning string literal', ++ 'SyntaxError: parameter without a default follows parameter with a default': ++ 'SyntaxError: non-default argument follows default argument', ++ "SyntaxError: 'yield from' outside function": ++ "SyntaxError: 'yield' outside function", ++ "SyntaxError: f-string: valid expression required before '}'": ++ 'SyntaxError: invalid syntax', ++ "SyntaxError: '{' was never closed": ++ 'SyntaxError: invalid syntax', ++ "SyntaxError: f-string: invalid conversion character 'b': expected 's', 'r', or 'a'": ++ "SyntaxError: f-string: invalid conversion character: expected 's', 'r', or 'a'", ++ "SyntaxError: (value error) Invalid format specifier ' 5' for object of type 'int'": ++ 'SyntaxError: f-string: expressions nested too deeply', ++ "SyntaxError: f-string: expecting a valid expression after '{'": ++ 'SyntaxError: f-string: invalid syntax', ++ "SyntaxError: f-string: expecting '=', or '!', or ':', or '}'": ++ 'SyntaxError: f-string: invalid syntax', ++ "SyntaxError: f-string: expecting '=', or '!', or ':', or '}'": ++ 'SyntaxError: f-string: invalid syntax', ++ } ++ ++ if wanted in translations: ++ wanted = translations[wanted] ++ elif wanted == 'SyntaxError: assignment to keyword': + return [wanted, "SyntaxError: can't assign to keyword", + 'SyntaxError: cannot assign to __debug__'], line_nr +- elif wanted == 'SyntaxError: f-string: unterminated string': +- wanted = 'SyntaxError: EOL while scanning string literal' + elif wanted == 'SyntaxError: f-string expression part cannot include a backslash': + return [ + wanted, + "SyntaxError: EOL while scanning string literal", + "SyntaxError: unexpected character after line continuation character", + ], line_nr +- elif wanted == "SyntaxError: f-string: expecting '}'": +- wanted = 'SyntaxError: EOL while scanning string literal' +- elif wanted == 'SyntaxError: f-string: empty expression not allowed': +- wanted = 'SyntaxError: invalid syntax' +- elif wanted == "SyntaxError: f-string expression part cannot include '#'": +- wanted = 'SyntaxError: invalid syntax' +- elif wanted == "SyntaxError: f-string: single '}' is not allowed": +- wanted = 'SyntaxError: invalid syntax' + elif "Maybe you meant '==' instead of '='?" in wanted: + wanted = wanted.removesuffix(" here. Maybe you meant '==' instead of '='?") + elif re.match( +@@ -148,18 +193,28 @@ + wanted, + ): + wanted = 'SyntaxError: EOF while scanning triple-quoted string literal' +- elif wanted == 'SyntaxError: cannot use starred expression here': +- wanted = "SyntaxError: can't use starred expression here" +- elif wanted == 'SyntaxError: f-string: cannot use starred expression here': +- wanted = "SyntaxError: f-string: can't use starred expression here" + elif re.match( + r"IndentationError: expected an indented block after '[^']*' statement on line \d", + wanted, + ): + wanted = 'IndentationError: expected an indented block' +- elif wanted == 'SyntaxError: unterminated string literal': +- wanted = 'SyntaxError: EOL while scanning string literal' +- return [wanted], line_nr ++ # The following two errors are produced for both some f-strings and ++ # some non-f-strings in Python 3.13: ++ elif wanted == "SyntaxError: can't use starred expression here": ++ wanted = [ ++ "SyntaxError: can't use starred expression here", ++ "SyntaxError: f-string: can't use starred expression here" ++ ] ++ elif wanted == 'SyntaxError: cannot mix bytes and nonbytes literals': ++ wanted = [ ++ 'SyntaxError: cannot mix bytes and nonbytes literals', ++ 'SyntaxError: f-string: cannot mix bytes and nonbytes literals' ++ ] ++ ++ if isinstance(wanted, list): ++ return wanted, line_nr ++ else: ++ return [wanted], line_nr + + + def test_default_except_error_postition(): diff -Nru parso-0.8.3/debian/patches/series parso-0.8.4/debian/patches/series --- parso-0.8.3/debian/patches/series 2022-12-04 14:32:46.000000000 +0000 +++ parso-0.8.4/debian/patches/series 2024-11-20 21:45:10.584898368 +0000 @@ -1,2 +1,2 @@ 0001-remove-forkme-logo-to-avoid-privacy-breach.patch -0002-Fix-unit-tests-in-Python-3.10.patch +python3.13-fixes.patch diff -Nru parso-0.8.3/debian/pybuild.testfiles parso-0.8.4/debian/pybuild.testfiles --- parso-0.8.3/debian/pybuild.testfiles 1970-01-01 01:00:00.000000000 +0100 +++ parso-0.8.4/debian/pybuild.testfiles 2024-11-20 21:39:33.297185486 +0000 @@ -0,0 +1,3 @@ +test +conftest.py +pytest.ini