pyparsing/0001-No-longer-use-undocumented-module-sre_constants.patch

43 lines
1.4 KiB
Diff

From 9da4012a025294413fc1f956e081ee003df2411e Mon Sep 17 00:00:00 2001
From: Serhiy Storchaka <storchaka@gmail.com>
Date: Thu, 28 Apr 2022 12:04:55 +0200
Subject: [PATCH] No longer use undocumented module 'sre_constants'
---
pyparsing.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/pyparsing.py b/pyparsing.py
index 581d5bb..774222b 100644
--- a/pyparsing.py
+++ b/pyparsing.py
@@ -105,7 +105,6 @@ import copy
import sys
import warnings
import re
-import sre_constants
import collections
import pprint
import traceback
@@ -3310,7 +3309,7 @@ class Regex(Token):
try:
self.re = re.compile(self.pattern, self.flags)
self.reString = self.pattern
- except sre_constants.error:
+ except re.error:
warnings.warn("invalid pattern (%s) passed to Regex" % pattern,
SyntaxWarning, stacklevel=2)
raise
@@ -3501,7 +3500,7 @@ class QuotedString(Token):
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:
warnings.warn("invalid pattern (%s) passed to Regex" % self.pattern,
SyntaxWarning, stacklevel=2)
raise
--
2.33.1