Skip to content

Commit

Permalink
Avoid assigning an empty error message to delegated parse exception (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
InSyncWithFoo committed Feb 12, 2024
1 parent 2a1a8e8 commit f02e401
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyparsing/core.py
Expand Up @@ -4510,7 +4510,8 @@ def parseImpl(self, instring, loc, doActions=True):
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

def leave_whitespace(self, recursive: bool = True) -> ParserElement:
Expand Down

0 comments on commit f02e401

Please sign in to comment.