Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No longer use undocumented module "sre_constants" #379

Merged
merged 1 commit into from Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions pyparsing/core.py
Expand Up @@ -23,7 +23,6 @@
import copy
import warnings
import re
import sre_constants
import sys
from collections.abc import Iterable
import traceback
Expand Down Expand Up @@ -2783,7 +2782,7 @@ def __init__(

try:
self.re = re.compile(self.reString)
except sre_constants.error:
except re.error:
self.re = None
else:
self.re_match = self.re.match
Expand Down Expand Up @@ -2966,7 +2965,7 @@ def re(self):
else:
try:
return re.compile(self.pattern, self.flags)
except sre_constants.error:
except re.error:
raise ValueError(
"invalid pattern ({!r}) passed to Regex".format(self.pattern)
)
Expand Down Expand Up @@ -3188,7 +3187,7 @@ def __init__(
self.re = re.compile(self.pattern, self.flags)
self.reString = self.pattern
self.re_match = self.re.match
except sre_constants.error:
except re.error:
raise ValueError(
"invalid pattern {!r} passed to Regex".format(self.pattern)
)
Expand Down
2 changes: 1 addition & 1 deletion pyparsing/helpers.py
Expand Up @@ -312,7 +312,7 @@ def one_of(

return ret

except sre_constants.error:
except re.error:
warnings.warn(
"Exception creating Regex for one_of, building MatchFirst", stacklevel=2
)
Expand Down