diff mercurial/pycompat.py @ 29455:0c741fd6158a

py3: conditionalize httplib import The httplib library is renamed to http.client in python 3. So the import is conditionalized and a test is added in check-code to warn to use util.httplib
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 28 Jun 2016 16:01:53 +0530
parents 33770d2b6cf9
children 075146e85bb6
line wrap: on
line diff
--- a/mercurial/pycompat.py	Wed Jun 29 19:43:27 2016 -0700
+++ b/mercurial/pycompat.py	Tue Jun 28 16:01:53 2016 +0530
@@ -18,6 +18,13 @@
     pickle.dumps # silence pyflakes
 
 try:
+    import httplib
+    httplib.HTTPException
+except ImportError:
+    import http.client as httplib
+    httplib.HTTPException
+
+try:
     import SocketServer as socketserver
     socketserver.ThreadingMixIn
 except ImportError: