changeset 6074:59a9dc9562e2

ignore: split up huge patterns Some versions of Python silently mishandle large regexes, so split them up at a conservative 20k.
author Matt Mackall <mpm@selenic.com>
date Mon, 11 Feb 2008 16:13:43 -0600
parents 89c70d496175
children 63e0e57ab157
files mercurial/util.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Sun Feb 10 13:19:24 2008 +0100
+++ b/mercurial/util.py	Mon Feb 11 16:13:43 2008 -0600
@@ -459,6 +459,8 @@
             return
         try:
             pat = '(?:%s)' % '|'.join([regex(k, p, tail) for (k, p) in pats])
+            if len(pat) > 20000:
+                raise OverflowError()
             return re.compile(pat).match
         except OverflowError:
             # We're using a Python with a tiny regex engine and we