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
=== modified file 'bzrlib/lazy_regex.py'
--- bzrlib/lazy_regex.py 2017-01-15 20:36:48 +0000
+++ bzrlib/lazy_regex.py 2017-01-30 09:10:45 +0000
@@ -1,4 +1,4 @@
1# Copyright (C) 2006 Canonical Ltd1# Copyright (C) 2006, 2008-2011, 2017 Canonical Ltd
2#2#
3# This program is free software; you can redistribute it and/or modify3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by4# it under the terms of the GNU General Public License as published by
@@ -133,11 +133,11 @@
133 " cause infinite recursion")133 " cause infinite recursion")
134134
135135
136# re.finditer get confused if it receives a LazyRegex136# Some libraries calls re.finditer which fails it if receives a LazyRegex.
137if getattr(re, 'finditer', None is not None):137if getattr(re, 'finditer', False):
138 def finditer_public(pattern, string, flags=0):138 def finditer_public(pattern, string, flags=0):
139 if isinstance(pattern, LazyRegex):139 if isinstance(pattern, LazyRegex):
140 return pattern.finditer(string)140 return pattern.finditer(string)
141 else:141 else:
142 return _real_re_compile(pattern, flags).finditer(string)142 return _real_re_compile(pattern, flags).finditer(string)
143re.finditer = finditer_public143 re.finditer = finditer_public
144144
=== modified file 'doc/en/release-notes/bzr-2.7.txt'
--- doc/en/release-notes/bzr-2.7.txt 2017-01-15 20:38:48 +0000
+++ doc/en/release-notes/bzr-2.7.txt 2017-01-30 09:10:45 +0000
@@ -31,7 +31,7 @@
31*********31*********
3232
33* Complete monkey-patching of re.finditer or LazyRegexps leak.33* Complete monkey-patching of re.finditer or LazyRegexps leak.
34 (Vincent Ladeuil, #1644003)34 (Vincent Ladeuil, #1644003, #1657238)
3535
36* Cope with paramiko making argument to SFTPFile.prefetch() mandatory.36* Cope with paramiko making argument to SFTPFile.prefetch() mandatory.
37 (Jelmer Vernooij, #1579093)37 (Jelmer Vernooij, #1579093)

Subscribers

People subscribed via source and target branches