##// END OF EJS Templates
http push: break infinite recursion on failure with Python 2.6.5 (issue2179)...
http push: break infinite recursion on failure with Python 2.6.5 (issue2179) Python 2.6.5 will keep resetting the retry count on redirects, for example when the server returns 401 on failing auth (like google code currently does). We stop the endless recursion by not resetting the count. http://bugs.python.org/issue3819 introduced the regression with Python 2.6.5. http://bugs.python.org/issue8797 discusses a fix which might make it to 2.6.6 and 2.7.0.

File last commit:

r10263:25e57239 stable
r11415:a1e575b4 default
Show More
strutil.py
34 lines | 913 B | text/x-python | PythonLexer
# strutil.py - string utilities for Mercurial
#
# Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
def findall(haystack, needle, start=0, end=None):
if end is None:
end = len(haystack)
if end < 0:
end += len(haystack)
if start < 0:
start += len(haystack)
while start < end:
c = haystack.find(needle, start, end)
if c == -1:
break
yield c
start = c + 1
def rfindall(haystack, needle, start=0, end=None):
if end is None:
end = len(haystack)
if end < 0:
end += len(haystack)
if start < 0:
start += len(haystack)
while end >= 0:
c = haystack.rfind(needle, start, end)
if c == -1:
break
yield c
end = c - 1