34 lines
915 B
Diff
34 lines
915 B
Diff
From 7bbb353dd258905510289bda3de87a8354daca3c Mon Sep 17 00:00:00 2001
|
|
From: Florian Bruhin <me@the-compiler.org>
|
|
Date: Tue, 26 Apr 2022 13:37:12 +0200
|
|
Subject: [PATCH] Adjust imports for Python 3.11
|
|
|
|
sre_parse and sre_constants are deprecated in 3.11, see https://github.com/python/cpython/issues/91308
|
|
---
|
|
lark/utils.py | 10 ++++++++--
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/lark/utils.py b/lark/utils.py
|
|
index 36f50d1..29d998b 100644
|
|
--- a/lark/utils.py
|
|
+++ b/lark/utils.py
|
|
@@ -173,8 +173,13 @@ except ImportError:
|
|
import sys, re
|
|
Py36 = (sys.version_info[:2] >= (3, 6))
|
|
|
|
-import sre_parse
|
|
-import sre_constants
|
|
+if sys.version_info >= (3, 11):
|
|
+ import re._parser as sre_parse
|
|
+ import re._constants as sre_constants
|
|
+else:
|
|
+ import sre_parse
|
|
+ import sre_constants
|
|
+
|
|
categ_pattern = re.compile(r'\\p{[A-Za-z_]+}')
|
|
def get_regexp_width(expr):
|
|
if regex:
|
|
--
|
|
2.35.3
|
|
|