]> granicus.if.org Git - python/commitdiff
make sure to check for this limit even if we're running with -O
authorFredrik Lundh <fredrik@pythonware.com>
Fri, 15 Oct 2004 06:15:08 +0000 (06:15 +0000)
committerFredrik Lundh <fredrik@pythonware.com>
Fri, 15 Oct 2004 06:15:08 +0000 (06:15 +0000)
Lib/sre_compile.py

index fa21d95f56850d1cab6b572fd9a3f2a4fd77fb8e..27ab1fe7482a0c2fc9046cc0cb392d008d509d6b 100644 (file)
@@ -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