=== modified file 'bzrlib/lazy_regex.py' --- bzrlib/lazy_regex.py 2011-12-19 13:23:58 +0000 +++ bzrlib/lazy_regex.py 2017-01-15 20:36:48 +0000 @@ -131,3 +131,13 @@ raise AssertionError( "re.compile has already been overridden as lazy_compile, but this would" \ " cause infinite recursion") + + +# Some libraries calls re.finditer which fails it if receives a LazyRegex. +if getattr(re, 'finditer', False): + def finditer_public(pattern, string, flags=0): + if isinstance(pattern, LazyRegex): + return pattern.finditer(string) + else: + return _real_re_compile(pattern, flags).finditer(string) + re.finditer = finditer_public