diff options
-rw-r--r-- | Lib/sre_compile.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py index fa21d95..27ab1fe 100644 --- a/Lib/sre_compile.py +++ b/Lib/sre_compile.py @@ -502,8 +502,10 @@ def compile(p, flags=0): # print code # XXX: <fl> 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 |