Package: pyparsing
Version: 3.1.3-1
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu resolute ubuntu-patch
Dear Maintainer,
Running python-pyvista autopkgtest[1] with Python 3.14 default produces the
following error:
168s
--------------------------------------------------------------------------------
169s ERROR: while parsing the following warning configuration:
169s
169s ignore:The .*interactive_bk.* attribute was deprecated in Matplotlib
3\.9.*:matplotlib.MatplotlibDeprecationWarning
169s
169s This error occurred:
169s
169s Traceback (most recent call last):
169s File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line
2121, in parse_warning_filter
169s category: type[Warning] = _resolve_warning_category(category_)
169s ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
169s File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line
2168, in _resolve_warning_category
169s m = __import__(module, None, None, [klass])
169s File "/usr/lib/python3/dist-packages/matplotlib/__init__.py", line 161, in
<module>
169s from . import _api, _version, cbook, _docstring, rcsetup
169s File "/usr/lib/python3/dist-packages/matplotlib/rcsetup.py", line 29, in
<module>
169s from matplotlib._fontconfig_pattern import parse_fontconfig_pattern
169s File "/usr/lib/python3/dist-packages/matplotlib/_fontconfig_pattern.py",
line 15, in <module>
169s from pyparsing import (
169s Group, Optional, ParseException, Regex, StringEnd, Suppress, ZeroOrMore,
one_of)
169s File "/usr/lib/python3/dist-packages/pyparsing/__init__.py", line 132, in
<module>
169s from .core import __diag__, __compat__
169s File "/usr/lib/python3/dist-packages/pyparsing/core.py", line 5637
169s return f"{type(self).__name__}: {retString}"
169s ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
169s SyntaxError: 'return' in a 'finally' block
This issue was fixed upstream[2] and I have cherry-picked the patch.
The alternative to resolve this issue is to release a new upstream version.
The attached patch can be applied to achieve the following:
* d/p/0001-Rewrite-to-remove-return-from-finally-block-Issue-57.patch:
apply upstream patch to resolve the parser failure (LP: #2143696).
Thanks for considering the patch.
[1]
https://objectstorage.prodstack5.canonical.com/swift/v1/AUTH_0f9aae918d5b4744bf7b827671c86842/autopkgtest-
resolute/resolute/arm64/p/python-pyvista/20260308_072703_9a7ea@/log.gz
[2] https://github.com/pyparsing/pyparsing/issues/578
-- System Information:
Debian Release: forky/sid
APT prefers questing-updates
APT policy: (500, 'questing-updates'), (500, 'questing-security'), (500,
'questing'), (100, 'questing-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 6.17.0-14-generic (SMP w/32 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru
pyparsing-3.1.3/debian/patches/0001-Rewrite-to-remove-return-from-finally-block-Issue-57.patch
pyparsing-3.1.3/debian/patches/0001-Rewrite-to-remove-return-from-finally-block-Issue-57.patch
---
pyparsing-3.1.3/debian/patches/0001-Rewrite-to-remove-return-from-finally-block-Issue-57.patch
1970-01-01 12:00:00.000000000 +1200
+++
pyparsing-3.1.3/debian/patches/0001-Rewrite-to-remove-return-from-finally-block-Issue-57.patch
2026-03-09 18:58:26.000000000 +1300
@@ -0,0 +1,42 @@
+From 28ef77eb0392ec592a0a22a770a95ef9405c9ef1 Mon Sep 17 00:00:00 2001
+From: ptmcg <[email protected]>
+Date: Mon, 17 Mar 2025 21:28:43 -0500
+Subject: [PATCH] Rewrite to remove return from finally block (Issue #578)
+Bug: https://github.com/pyparsing/pyparsing/issues/578
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/pyparsing/+bug/2143696
+Origin: backport,
https://github.com/pyparsing/pyparsing/commit/28ef77eb0392ec592a0a22a770a95ef9405c9ef1
+
+---
+ pyparsing/__init__.py | 2 +-
+ pyparsing/core.py | 8 ++++----
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+--- a/pyparsing/core.py
++++ b/pyparsing/core.py
+@@ -39,7 +39,6 @@
+ __config_flags,
+ _collapse_string_to_ranges,
+ _escape_regex_range_chars,
+- _bslash,
+ _flatten,
+ LRUMemo as _LRUMemo,
+ UnboundedMemo as _UnboundedMemo,
+@@ -5627,14 +5626,15 @@
+ self._defaultName = ": ..."
+
+ # Use the string representation of main expression.
+- retString = "..."
+ try:
+ if self.expr is not None:
+ retString = str(self.expr)[:1000]
+ else:
+ retString = "None"
+- finally:
+- return f"{type(self).__name__}: {retString}"
++ except Exception:
++ retString = "..."
++
++ return f"{type(self).__name__}: {retString}"
+
+ def copy(self) -> ParserElement:
+ if self.expr is not None:
diff -Nru pyparsing-3.1.3/debian/patches/series
pyparsing-3.1.3/debian/patches/series
--- pyparsing-3.1.3/debian/patches/series 1970-01-01 12:00:00.000000000
+1200
+++ pyparsing-3.1.3/debian/patches/series 2026-03-09 18:58:26.000000000
+1300
@@ -0,0 +1 @@
+0001-Rewrite-to-remove-return-from-finally-block-Issue-57.patch