From 5e7d51b62cc86314987b833a2a800b9528e906d7 Mon Sep 17 00:00:00 2001 From: Fredrik Lundh Date: Fri, 15 Oct 2004 06:15:08 +0000 Subject: [PATCH] make sure to check for this limit even if we're running with -O --- Lib/sre_compile.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py index fa21d95f56..27ab1fe748 100644 --- a/Lib/sre_compile.py +++ b/Lib/sre_compile.py @@ -502,8 +502,10 @@ def compile(p, flags=0): # print code # XXX: get rid of this limitation! - assert p.pattern.groups <= 100,\ - "sorry, but this version only supports 100 named groups" + if p.pattern.groups > 100: + raise AssertionError( + "sorry, but this version only supports 100 named groups" + ) # map in either direction groupindex = p.pattern.groupdict -- 2.40.0