# HG changeset patch # User Augie Fackler # Date 2015-05-19 02:40:16 # Node ID 7a1af58ab2425e44da460f6e3571c9048aba7d64 # Parent 472a685a49618c684ef7a03ce977bc442f7b6ce8 statichttprepo: remove wrong getattr ladder At least as far back as Python 2.6 the .code attribute is always defined, and to the best of my detective skills a .getcode() method has never been a thing. diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py --- a/mercurial/statichttprepo.py +++ b/mercurial/statichttprepo.py @@ -32,11 +32,7 @@ class httprangereader(object): try: f = self.opener.open(req) data = f.read() - # Python 2.6+ defines a getcode() function, and 2.4 and - # 2.5 appear to always have an undocumented code attribute - # set. If we can't read either of those, fall back to 206 - # and hope for the best. - code = getattr(f, 'getcode', lambda : getattr(f, 'code', 206))() + code = f.code except urllib2.HTTPError, inst: num = inst.code == 404 and errno.ENOENT or None raise IOError(num, inst)