##// END OF EJS Templates
match: test for overflow error in pattern...
Boris Feld -
r40811:4e02f25f default
parent child Browse files
Show More
@@ -1188,7 +1188,16 b' MAX_RE_SIZE = 20000'
1188
1188
1189 def _buildregexmatch(kindpats, globsuffix):
1189 def _buildregexmatch(kindpats, globsuffix):
1190 """Build a match function from a list of kinds and kindpats,
1190 """Build a match function from a list of kinds and kindpats,
1191 return regexp string and a matcher function."""
1191 return regexp string and a matcher function.
1192
1193 Test too large input
1194 >>> _buildregexmatch([
1195 ... ('relglob', '?' * MAX_RE_SIZE, '')
1196 ... ], '$')
1197 Traceback (most recent call last):
1198 ...
1199 OverflowError
1200 """
1192 try:
1201 try:
1193 regex = '(?:%s)' % '|'.join([_regex(k, p, globsuffix)
1202 regex = '(?:%s)' % '|'.join([_regex(k, p, globsuffix)
1194 for (k, p, s) in kindpats])
1203 for (k, p, s) in kindpats])
General Comments 0
You need to be logged in to leave comments. Login now