From b31ef8f15d7976907da7bb9e836f77b6401d202c Mon Sep 17 00:00:00 2001 From: MegaIng Date: Thu, 7 Dec 2023 16:01:06 +0100 Subject: [PATCH] MAXWIDTH is not part of sre_constants --- lark/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lark/utils.py b/lark/utils.py index f3d74c24..70ac27e2 100644 --- a/lark/utils.py +++ b/lark/utils.py @@ -149,9 +149,9 @@ def get_regexp_width(expr: str) -> Union[Tuple[int, int], List[int]]: # sre_parse does not support the new features in regex. To not completely fail in that case, # we manually test for the most important info (whether the empty string is matched) c = regex.compile(regexp_final) - # Python 3.11.7 introducded sre_constants.MAXWIDTH that is used instead of MAXREPEAT + # Python 3.11.7 introducded sre_parse.MAXWIDTH that is used instead of MAXREPEAT # See lark-parser/lark#1376 and python/cpython#109859 - MAXWIDTH = getattr(sre_constants, "MAXWIDTH", sre_constants.MAXREPEAT) + MAXWIDTH = getattr(sre_parse, "MAXWIDTH", sre_constants.MAXREPEAT) if c.match('') is None: # MAXREPEAT is a none pickable subclass of int, therefore needs to be converted to enable caching return 1, int(MAXWIDTH)