summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2004-10-15 06:15:08 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2004-10-15 06:15:08 (GMT)
commit5e7d51b62cc86314987b833a2a800b9528e906d7 (patch)
treee86604219d34d0fabb98b35835223991c3aa0b40
parentd37ddeba4c2a5d55ab526cc040beea4feb2ad0c6 (diff)
downloadcpython-5e7d51b62cc86314987b833a2a800b9528e906d7.zip
cpython-5e7d51b62cc86314987b833a2a800b9528e906d7.tar.gz
cpython-5e7d51b62cc86314987b833a2a800b9528e906d7.tar.bz2
make sure to check for this limit even if we're running with -O
-rw-r--r--Lib/sre_compile.py6
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