Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
29449:5b71a8d7f7ff | 29455:0c741fd6158a |
---|---|
14 import cPickle as pickle | 14 import cPickle as pickle |
15 pickle.dumps | 15 pickle.dumps |
16 except ImportError: | 16 except ImportError: |
17 import pickle | 17 import pickle |
18 pickle.dumps # silence pyflakes | 18 pickle.dumps # silence pyflakes |
19 | |
20 try: | |
21 import httplib | |
22 httplib.HTTPException | |
23 except ImportError: | |
24 import http.client as httplib | |
25 httplib.HTTPException | |
19 | 26 |
20 try: | 27 try: |
21 import SocketServer as socketserver | 28 import SocketServer as socketserver |
22 socketserver.ThreadingMixIn | 29 socketserver.ThreadingMixIn |
23 except ImportError: | 30 except ImportError: |