changeset 25196:7a1af58ab242

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.
author Augie Fackler <raf@durin42.com>
date Mon, 18 May 2015 22:40:16 -0400
parents 472a685a4961
children 6faa7d986a8b
files mercurial/statichttprepo.py
diffstat 1 files changed, 1 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/statichttprepo.py	Tue May 19 07:17:57 2015 -0500
+++ b/mercurial/statichttprepo.py	Mon May 18 22:40:16 2015 -0400
@@ -32,11 +32,7 @@
         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)