Fix regression in pyparsing 3.1.1

See the following link for further details:

https://github.com/eerimoq/asn1tools/issues/167

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
This commit is contained in:
Peter Lemenkov 2024-02-12 13:42:54 +01:00
parent 70917da7f3
commit 48b3f1f261
2 changed files with 21 additions and 1 deletions

View File

@ -0,0 +1,20 @@
From: InSync <122007197+InSyncWithFoo@users.noreply.github.com>
Date: Sat, 13 Jan 2024 05:04:57 +0000
Subject: [PATCH] Avoid assigning an empty error message to delegated parse
exception
diff --git a/pyparsing/core.py b/pyparsing/core.py
index 73514ed..fc19d1c 100644
--- a/pyparsing/core.py
+++ b/pyparsing/core.py
@@ -4569,7 +4569,8 @@ class ParseElementEnhance(ParserElement):
return self.expr._parse(instring, loc, doActions, callPreParse=False)
except ParseBaseException as pbe:
if not isinstance(self, Forward) or self.customName is not None:
- pbe.msg = self.errmsg
+ if self.errmsg:
+ pbe.msg = self.errmsg
raise
else:
raise ParseException(instring, loc, "No expression defined", self)

View File

@ -7,7 +7,7 @@ Release: %autorelease
License: MIT
URL: https://github.com/pyparsing/pyparsing
Source0: https://github.com/%{name}/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
Patch1: pyparsing-0001-Avoid-assigning-an-empty-error-message-to-delegated-.patch
BuildArch: noarch
BuildRequires: dos2unix