debugcommands: urlerror only has a read() method in Python 2
authorAugie Fackler <augie@google.com>
Fri, 10 Aug 2018 03:33:38 -0400
changeset 39065 730e7d92a023
parent 39064 a2fa7247ca70
child 39066 2488dcfa71f8
debugcommands: urlerror only has a read() method in Python 2 Differential Revision: https://phab.mercurial-scm.org/D4258
mercurial/debugcommands.py
--- a/mercurial/debugcommands.py	Fri Aug 10 03:31:23 2018 -0400
+++ b/mercurial/debugcommands.py	Fri Aug 10 03:33:38 2018 -0400
@@ -3207,7 +3207,8 @@
                 res = opener.open(req)
                 body = res.read()
             except util.urlerr.urlerror as e:
-                e.read()
+                # read() method must be called, but only exists in Python 2
+                getattr(e, 'read', lambda: None)()
                 continue
 
             if res.headers.get('Content-Type') == 'application/mercurial-cbor':