Merge lp:~vila/bzr/1657238-wrong-import into lp:bzr/2.7

Proposed by Vincent Ladeuil
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 6622
Proposed branch: lp:~vila/bzr/1657238-wrong-import
Merge into: lp:bzr/2.7
Diff against target: 37 lines (+5/-5)
2 files modified
bzrlib/lazy_regex.py (+4/-4)
doc/en/release-notes/bzr-2.7.txt (+1/-1)
To merge this branch: bzr merge lp:~vila/bzr/1657238-wrong-import
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) Approve
Review via email: mp+315874@code.launchpad.net

Commit message

Properly monkey-patch re.finditer

Description of the change

The previous attempt was obviously broken (working but causing bug #1657238 in some contexts).

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '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:10:45 +0000
4@@ -1,4 +1,4 @@
5-# Copyright (C) 2006 Canonical Ltd
6+# Copyright (C) 2006, 2008-2011, 2017 Canonical Ltd
7 #
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
10@@ -133,11 +133,11 @@
11 " cause infinite recursion")
12
13
14-# re.finditer get confused if it receives a LazyRegex
15-if getattr(re, 'finditer', None is not None):
16+# Some libraries calls re.finditer which fails it if receives a LazyRegex.
17+if getattr(re, 'finditer', False):
18 def finditer_public(pattern, string, flags=0):
19 if isinstance(pattern, LazyRegex):
20 return pattern.finditer(string)
21 else:
22 return _real_re_compile(pattern, flags).finditer(string)
23-re.finditer = finditer_public
24+ re.finditer = finditer_public
25
26=== modified file 'doc/en/release-notes/bzr-2.7.txt'
27--- doc/en/release-notes/bzr-2.7.txt 2017-01-15 20:38:48 +0000
28+++ doc/en/release-notes/bzr-2.7.txt 2017-01-30 09:10:45 +0000
29@@ -31,7 +31,7 @@
30 *********
31
32 * Complete monkey-patching of re.finditer or LazyRegexps leak.
33- (Vincent Ladeuil, #1644003)
34+ (Vincent Ladeuil, #1644003, #1657238)
35
36 * Cope with paramiko making argument to SFTPFile.prefetch() mandatory.
37 (Jelmer Vernooij, #1579093)

Subscribers

People subscribed via source and target branches