[Python-modules-team] Bug#796356: python-urllib3: broken when python-future is installed, fix available upstream
Edward Betts
edward at 4angle.com
Fri Aug 21 13:56:09 UTC 2015
Package: python-urllib3
Version: 1.11-1
Severity: normal
This version of the package fails to work when python-future is installed.
$ python
Python 2.7.10 (default, Jul 1 2015, 10:54:53)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.get('http://debian.org/')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/requests/api.py", line 69, in get
return request('get', url, params=params, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/api.py", line 50, in request
response = session.request(method=method, url=url, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 370, in send
timeout=timeout
File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 557, in urlopen
body=body, headers=headers)
File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 388, in _make_request
assert_header_parsing(httplib_response.msg)
File "/usr/lib/python2.7/dist-packages/urllib3/util/response.py", line 49, in assert_header_parsing
if not isinstance(headers, httplib.HTTPMessage):
AttributeError: 'module' object has no attribute 'HTTPMessage'
>>>
$
The start of urllib3/util/response.py looks like:
try:
import http.client as httplib
except ImportError:
import httplib
The try is expected to fail on Python 2.7, but it succeeds because
python-future includes /usr/lib/python2.7/dist-packages/http/client.py which
looks like this:
from __future__ import absolute_import
import sys
assert sys.version_info[0] < 3
from httplib import *
Here is the upstream fix:
https://github.com/shazow/urllib3/commit/f4eb94bc36277d5d584683a03fc9eb3950429a15
-- System Information:
Debian Release: stretch/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.0.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages python-urllib3 depends on:
ii python-six 1.9.0-3
pn python:any <none>
Versions of packages python-urllib3 recommends:
ii ca-certificates 20150426
ii python-ndg-httpsclient 0.4.0-1
ii python-openssl 0.15.1-2
ii python-pyasn1 0.1.8-1
Versions of packages python-urllib3 suggests:
pn python-ntlm <none>
-- no debconf information
--
Edward.
More information about the Python-modules-team
mailing list