[issue23300] An improper change in httplib.py

2015-01-22 Thread Guohua Ouyang

New submission from Guohua Ouyang:

Following the issue 7776, there is a patch for 2.7 version.

Which changes the method of class HTTPConnection from _set_hostport to 
_get_hostport[1], it seems introduce in some incompatibility issues.

On my system, the file /usr/lib64/python2.7/site-packages/mercurial/url.py 
from package mercurial-3.0-2.fc21 still use the old method _set_hostport. I 
met an error AttributeError: httpsconnection instance has no attribute 
'_set_hostport' when use this package. I only see this incompatibility issue 
so far.

And in the file httplib.py itself, [2] still use 
self._conn._set_hostport(host, port), which should be 
self._conn._get_hostport(host, port) if it's settled to rename 
_set_hostport to _get_hostport.

[1] https://github.com/python/cpython/blob/2.7/Lib/httplib.py#L743
[2] https://github.com/python/cpython/blob/2.7/Lib/httplib.py#L1132

--
components: Library (Lib)
messages: 234488
nosy: guohua
priority: normal
severity: normal
status: open
title: An improper change in httplib.py
type: enhancement
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23300
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



An improper change in httplib.py

2015-01-22 Thread Guohua Ouyang
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: 

Re: An improper change in httplib.py

2015-01-22 Thread Mark Lawrence

On 22/01/2015 03:38, Guohua Ouyang wrote:

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


You've found a bug so please raise it on bugs.python.org :)

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


[issue23300] An improper change in httplib.py

2015-01-22 Thread Brett Cannon

Brett Cannon added the comment:

That leading underscore in the method name means it is not a public API and 
thus changes are allowed without any backwards-compatibility guarantees. 
Mercurial will need to update their code to handle this if they want to 
continue to use the method.

--
nosy: +brett.cannon
resolution:  - wont fix
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23300
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: An improper change in httplib.py

2015-01-22 Thread Guohua Ouyang
Have reported an issue http://bugs.python.org/issue23300.

That leading underscore in the method name means it is not a public
API and thus changes are allowed without any backwards-compatibility
guarantees. Mercurial will need to update their code to handle this if
they want to continue to use the method.

I checked the official mercurial repo, it does not use the method
anymore, so I filed a bug to fedora. [1]

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1185105

On Thu, Jan 22, 2015 at 8:04 PM, Mark Lawrence breamore...@yahoo.co.uk wrote:
 No problem, but out of courtesy could you please reply to the list and not
 just me.

 Kindest regards.

 Mark Lawrence.


 On Thursday, 22 January 2015, 11:51, Guohua Ouyang ouyanggh0...@gmail.com
 wrote:



 thanks, file the issue 23300

 On Thu, Jan 22, 2015 at 5:06 PM, Mark Lawrence breamore...@yahoo.co.uk
 wrote:
 On 22/01/2015 03:38, Guohua Ouyang wrote:

 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


 You've found a bug so please raise it on bugs.python.org :)

 --
 My fellow Pythonistas, ask not what our language can do for you, ask
 what you can do for our language.

 Mark Lawrence

 --
 https://mail.python.org/mailman/listinfo/python-list


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: An improper change in httplib.py

2015-01-22 Thread Mark Lawrence

On 22/01/2015 22:35, Guohua Ouyang wrote:

Have reported an issue http://bugs.python.org/issue23300.

That leading underscore in the method name means it is not a public
API and thus changes are allowed without any backwards-compatibility
guarantees. Mercurial will need to update their code to handle this if
they want to continue to use the method.

I checked the official mercurial repo, it does not use the method
anymore, so I filed a bug to fedora. [1]

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1185105



That comment on the issue is just wrong.  The issue has been re-opened.

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


[issue23300] An improper change in httplib.py

2015-01-22 Thread Mark Lawrence

Mark Lawrence added the comment:

This is a bug first reported here 
https://mail.python.org/pipermail/python-list/2015-January/697228.html.  The 
problem is that in #7776 r90728 568041fd8090 _set_hostport was renamed to 
_get_hostport but there is still a call to the former at line 1132 in 
httplib.py.

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23300
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23300] An improper change in httplib.py

2015-01-22 Thread Benjamin Peterson

Benjamin Peterson added the comment:

There's definitely a bug because httplib is now using a method that doesn't 
exist.

--
nosy: +benjamin.peterson, orsenthil
resolution: wont fix - 
status: closed - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23300
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com