From db0d1dab29cb2326dc7aef4ce1c45817c09a75ea Mon Sep 17 00:00:00 2001
From: Petr Stodulka <pstodulk@redhat.com>
Date: Thu, 26 Jan 2017 12:39:20 +0100
Subject: [PATCH] Fixes incompatibility with python 2.7.13 (#1416324)
---
bzrlib/lazy_regex.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/bzrlib/lazy_regex.py b/bzrlib/lazy_regex.py
index afd450a..c07eded 100644
--- a/bzrlib/lazy_regex.py
+++ b/bzrlib/lazy_regex.py
@@ -131,3 +131,14 @@ if _real_re_compile is lazy_compile:
raise AssertionError(
"re.compile has already been overridden as lazy_compile, but this would" \
" cause infinite recursion")
+
+
+# re.finditer get confused if it receives a LazyRegex
+if getattr(re, 'finditer', None is not None):
+ 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
+
--
2.5.5