[PATCH 1 of 3] py3: conditionalize httplib import
Yuya Nishihara
yuya at tcha.org
Fri Jul 1 14:37:13 UTC 2016
On Thu, 30 Jun 2016 15:17:18 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1467109913 -19800
> # Tue Jun 28 16:01:53 2016 +0530
> # Node ID 752f11e6e60f6214335dd761e6bb045d63747bbb
> # Parent f251c4c4f77bd2be42ff69b71c74c2778febac90
> py3: conditionalize httplib import
Queued the first patch per Martijn's review, thanks.
> --- a/mercurial/pycompat.py Mon Jun 27 19:10:30 2016 +0530
> +++ 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
The util module is getting more and more demandimport unfriendly. I'd rather
make them test the Python version than try importing. Any idea?
if sys.version_info[0] < 3:
import httplib
else:
import http.client as httplib
More information about the Mercurial-devel
mailing list