[PATCH 7 of 7] get-with-headers: handle httplib py3 divergence
timeless
timeless at gmail.com
Wed May 18 13:05:35 EDT 2016
On Wed, May 18, 2016 at 9:42 AM, Martijn Pieters <mj at zopatista.com> wrote:
> On 11 May 2016 at 06:20, timeless <timeless at fmr.im> wrote:
>> # HG changeset patch
>> # User timeless <timeless at mozdev.org>
>> # Date 1462561726 0
>> # Fri May 06 19:08:46 2016 +0000
>> # Node ID a2806b270837492edb52a1146c12d9c1b5deed6d
>> # Parent 6849a6b26ea35775c142b78802b6b943dd2adf68
>> # EXP-Topic runtests
>> # Available At bb://timeless/mercurial-crew
>> # hg pull bb://timeless/mercurial-crew -r a2806b270837
>> get-with-headers: handle httplib py3 divergence
>>
>> With this final change, get-with-headers.py works in Python 3
>>
>> diff -r 6849a6b26ea3 -r a2806b270837 tests/get-with-headers.py
>> --- a/tests/get-with-headers.py Fri May 06 19:07:23 2016 +0000
>> +++ b/tests/get-with-headers.py Fri May 06 19:08:46 2016 +0000
>> @@ -5,12 +5,17 @@
>>
>> from __future__ import absolute_import, print_function
>>
>> -import httplib
>> import json
>> import os
>> import sys
>>
>> try:
>> + import httplib
>> + httplib.HTTPException
>> +except ImportError:
>> + import http.client as httplib
>
> Why the httplib.HTTPException attribute test here? Surely that can be
> dropped, as you don't handle the AttributeError that could throw if
> the attribute is missing. And the exception isn't missing in either
> 2.6 or 2.7, and 3.5 will throw ImportError on the import httplib line
> and never reaches that line.
copy/paste from mercurial where demandimport requires it. Feel free to
drop the line.
More information about the Mercurial-devel
mailing list