equal
deleted
inserted
replaced
1186 |
1186 |
1187 MAX_RE_SIZE = 20000 |
1187 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]) |
1195 if len(regex) <= MAX_RE_SIZE: |
1204 if len(regex) <= MAX_RE_SIZE: |
1196 return regex, _rematcher(regex) |
1205 return regex, _rematcher(regex) |