~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lazy_regex.py

  • Committer: Vincent Ladeuil
  • Date: 2017-01-30 14:30:10 UTC
  • mfrom: (6615.3.7 merges)
  • mto: This revision was merged to the branch mainline in revision 6621.
  • Revision ID: v.ladeuil+lp@free.fr-20170130143010-p31t1ranfeqbaeki
Merge  2.7 into trunk including fix for bug #1657238

Show diffs side-by-side

added added

removed removed

Lines of Context:
133
133
        " cause infinite recursion")
134
134
 
135
135
 
136
 
# re.finditer get confused if it receives a LazyRegex
137
 
if getattr(re, 'finditer', None is not None):
 
136
# Some libraries calls re.finditer which fails it if receives a LazyRegex.
 
137
if getattr(re, 'finditer', False):
138
138
    def finditer_public(pattern, string, flags=0):
139
139
        if isinstance(pattern, LazyRegex):
140
140
            return pattern.finditer(string)
141
141
        else:
142
142
            return _real_re_compile(pattern, flags).finditer(string)
143
 
re.finditer = finditer_public
 
143
    re.finditer = finditer_public