1 diff -u bzrlib/lazy_regex.py bzrlib/lazy_regex.py
2 --- bzrlib/lazy_regex.py 2017-01-15 20:36:48 +0000
3 +++ bzrlib/lazy_regex.py 2017-01-30 09:08:25 +0000
5 -# Copyright (C) 2006 Canonical Ltd
6 +# Copyright (C) 2006, 2008-2011, 2017 Canonical Ltd
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
13 +# Some libraries calls re.finditer which fails it if receives a LazyRegex.
14 +if getattr(re, 'finditer', False):
15 + def finditer_public(pattern, string, flags=0):
16 + if isinstance(pattern, LazyRegex):
17 + return pattern.finditer(string)
19 + return _real_re_compile(pattern, flags).finditer(string)
20 + re.finditer = finditer_public