Python 3.11: No longer use the undocumented sre_constants module
This commit is contained in:
parent
b040c5a228
commit
ea6fb2f54b
42
0001-No-longer-use-undocumented-module-sre_constants.patch
Normal file
42
0001-No-longer-use-undocumented-module-sre_constants.patch
Normal file
@ -0,0 +1,42 @@
|
||||
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
|
||||
|
@ -18,6 +18,11 @@ License: MIT
|
||||
URL: https://github.com/pyparsing/pyparsing
|
||||
Source0: https://github.com/%{name}/%{name}/archive/%{name}_%{version}/%{name}-%{version}.tar.gz
|
||||
|
||||
# sre_constants module is deprecated in Python 3.11, this patch replaces it with the re module
|
||||
# Merged upstream in https://github.com/pyparsing/pyparsing/pull/379
|
||||
# Included in 3.0.8+
|
||||
Patch: 0001-No-longer-use-undocumented-module-sre_constants.patch
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: dos2unix
|
||||
BuildRequires: python%{python3_pkgversion}-devel
|
||||
@ -72,7 +77,8 @@ This is the Python 3 version.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{name}_%{version}
|
||||
%autosetup -p1 -n %{name}-%{name}_%{version}
|
||||
|
||||
dos2unix -k CHANGES LICENSE
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user