An improper change in httplib.py

Guohua Ouyang ouyanggh0815 at gmail.com
Thu Jan 22 04:38:22 CET 2015


This is my first post to the list, I apologies firstly if I made any mistake.

I was trying to get a package in golang behind the http or https
proxy, and it reports  an error "AttributeError: httpsconnection
instance has no attribute '_set_hostport'", details in the bottom.
After some trace work, I found it caused by the changes in the issue issue7776.

@@ -718,7 +734,7 @@
         else:
             self._tunnel_headers.clear()

-    def _set_hostport(self, host, port):
+    def _get_hostport(self, host, port):

First, it changes the method's name, doesn't it break the
compatibility for other packages, on my system,
mercurial-3.0-2.fc21.x86_64 still use "_set_hostport" as the error
shows.

Second, I found that line 1132 of [2] still use "
self._conn._set_hostport(host, port)", which should be
"_get_hostport", right?

[1] http://bugs.python.org/issue7776
[2] https://github.com/python/cpython/blob/2.7/Lib/httplib.py


$ go get code.google.com/p/go-uuid/uuid
# cd .; hg clone -U https://code.google.com/p/go-uuid
/home/guohua/go/src/code.google.com/p/go-uuid
** unknown exception encountered, please report by visiting
** http://mercurial.selenic.com/wiki/BugTracker
** Python 2.7.8 (default, Nov 10 2014, 08:19:18) [GCC 4.9.2 20141101
(Red Hat 4.9.2-1)]
** Mercurial Distributed SCM (version 3.0)
** Extensions loaded:
Traceback (most recent call last):
  File "/usr/bin/hg", line 38, in <module>
    mercurial.dispatch.run()
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py",
line 28, in run
    sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py",
line 69, in dispatch
    ret = _runcatch(req)
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py",
line 138, in _runcatch
    return _dispatch(req)
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py",
line 810, in _dispatch
    cmdpats, cmdoptions)
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py",
line 590, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py",
line 901, in _runcommand
    return checkargs()
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py",
line 872, in checkargs
    return cmdfunc()
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py",
line 807, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/usr/lib64/python2.7/site-packages/mercurial/util.py", line
518, in check
    return func(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/mercurial/commands.py",
line 1298, in clone
    branch=opts.get('branch'))
  File "/usr/lib64/python2.7/site-packages/mercurial/hg.py", line 295, in clone
    srcpeer = peer(ui, peeropts, source)
  File "/usr/lib64/python2.7/site-packages/mercurial/hg.py", line 129, in peer
    return _peerorrepo(rui, path, create).peer()
  File "/usr/lib64/python2.7/site-packages/mercurial/hg.py", line 106,
in _peerorrepo
    obj = _peerlookup(path).instance(ui, path, create)
  File "/usr/lib64/python2.7/site-packages/mercurial/httppeer.py",
line 261, in instance
    inst._fetchcaps()
  File "/usr/lib64/python2.7/site-packages/mercurial/httppeer.py",
line 58, in _fetchcaps
    self.caps = set(self._call('capabilities').split())
  File "/usr/lib64/python2.7/site-packages/mercurial/httppeer.py",
line 172, in _call
    fp = self._callstream(cmd, **args)
  File "/usr/lib64/python2.7/site-packages/mercurial/httppeer.py",
line 119, in _callstream
    resp = self.urlopener.open(req)
  File "/usr/lib64/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/usr/lib64/python2.7/urllib2.py", line 422, in _open
    '_open', req)
  File "/usr/lib64/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib64/python2.7/site-packages/mercurial/url.py", line
372, in https_open
    return self.do_open(self._makeconnection, req)
  File "/usr/lib64/python2.7/site-packages/mercurial/keepalive.py",
line 254, in do_open
    self._start_transaction(h, req)
  File "/usr/lib64/python2.7/site-packages/mercurial/url.py", line
358, in _start_transaction
    return keepalive.KeepAliveHandler._start_transaction(self, h, req)
  File "/usr/lib64/python2.7/site-packages/mercurial/keepalive.py",
line 352, in _start_transaction
    h.endheaders()
  File "/usr/lib64/python2.7/httplib.py", line 991, in endheaders
    self._send_output(message_body)
  File "/usr/lib64/python2.7/httplib.py", line 844, in _send_output
    self.send(msg)
  File "/usr/lib64/python2.7/site-packages/mercurial/url.py", line
144, in _sendfile
    orgsend(self, data)
  File "/usr/lib64/python2.7/site-packages/mercurial/keepalive.py",
line 532, in safesend
    self.connect()
  File "/usr/lib64/python2.7/site-packages/mercurial/url.py", line
342, in connect
    _generic_proxytunnel(self)
  File "/usr/lib64/python2.7/site-packages/mercurial/url.py", line
228, in _generic_proxytunnel
    self._set_hostport(self.host, self.port)
AttributeError: httpsconnection instance has no attribute '_set_hostport'
package code.google.com/p/go-uuid/uuid: exit status 1



More information about the Python-list mailing list