Skip to content

Commit

Permalink
Update CHANGES and timestamp from #362; fix related unit test and Val…
Browse files Browse the repository at this point in the history
…ueError message
  • Loading branch information
ptmcg committed Feb 6, 2022
1 parent 5a411e3 commit 1a39f11
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyparsing/__init__.py
Expand Up @@ -126,7 +126,7 @@ def __repr__(self):


__version_info__ = version_info(3, 0, 7, "final", 0)
__version_time__ = "06 Feb 2022 01:42 UTC"
__version_time__ = "06 Feb 2022 02:15 UTC"
__version__ = __version_info__.__version__
__versionTime__ = __version_time__
__author__ = "Paul McGuire <ptmcg.gm+pyparsing@gmail.com>"
Expand Down
5 changes: 2 additions & 3 deletions pyparsing/core.py
Expand Up @@ -53,7 +53,7 @@
str_type: Tuple[type, ...] = (str, bytes)

#
# Copyright (c) 2003-2021 Paul T. McGuire
# Copyright (c) 2003-2022 Paul T. McGuire
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
Expand Down Expand Up @@ -2960,7 +2960,6 @@ def __init__(
if self.asMatch:
self.parseImpl = self.parseImplAsMatch


@cached_property
def re(self):
if self._re:
Expand All @@ -2970,7 +2969,7 @@ def re(self):
return re.compile(self.pattern, self.flags)
except sre_constants.error:
raise ValueError(
"invalid pattern ({!r}) passed to Regex".format(pattern)
"invalid pattern ({!r}) passed to Regex".format(self.pattern)
)

@cached_property
Expand Down
4 changes: 2 additions & 2 deletions tests/test_unit.py
Expand Up @@ -3487,7 +3487,7 @@ def testMatch(expression, instring, shouldPass, expectedString=None):
try:
print("lets try an invalid RE")
invRe = pp.Regex("(\"[^\"]*\")|('[^']*'").re
except Exception as e:
except ValueError as e:
print("successfully rejected an invalid RE:", end=" ")
print(e)
else:
Expand All @@ -3496,7 +3496,7 @@ def testMatch(expression, instring, shouldPass, expectedString=None):
with self.assertRaises(
ValueError, msg="failed to warn empty string passed to Regex"
):
invRe = pp.Regex("")
pp.Regex("").re

def testRegexAsType(self):

Expand Down

0 comments on commit 1a39f11

Please sign in to comment.