[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2016-05-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Interesting. I didn't know that "hg graft" keeps the author and data of the original commit. Maybe this is a Mercurial bug. -- ___ Python tracker ___

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2016-05-16 Thread Martin Panter
Martin Panter added the comment: Sorry that was actually made by me earlier today. I grafted it from your commit, but I always forget to reset the author and date. -- ___ Python tracker ___

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2016-05-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Oh, Roundup Robot reports about a commit made almost 2 years ago! -- ___ Python tracker ___ ___ Py

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2016-05-16 Thread Roundup Robot
Roundup Robot added the comment: New changeset 19e4e0b7f1bd by Serhiy Storchaka in branch '2.7': Issue #19524: Port fakehttp() from Py3 c1fb19907cc4 for use in test_urllib2 https://hg.python.org/cpython/rev/19e4e0b7f1bd -- ___ Python tracker

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2014-09-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for your contribution Martin. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed type: -> behavior ___ Python tracker

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2014-09-06 Thread Roundup Robot
Roundup Robot added the comment: New changeset c1fb19907cc4 by Serhiy Storchaka in branch '3.4': Issue #19524: Fixed resource leak in the HTTP connection when an invalid http://hg.python.org/cpython/rev/c1fb19907cc4 New changeset 43bf95480c3c by Serhiy Storchaka in branch 'default': Issue #19524

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2014-07-16 Thread Martin Panter
Martin Panter added the comment: Added a new test for the invalid response case. Now both tests are included in test2.patch. I separated the actual fix into a separate close3.4.patch (refreshed for the 3.4 branch). This way it is easier for me to make sure the tests work before applying the f

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2014-07-16 Thread Martin Panter
Changes by Martin Panter : Added file: http://bugs.python.org/file35980/test2.patch ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2014-07-16 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2014-07-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: LGTM. Do you want to write a test for the case when an invalid response is received? -- versions: +Python 3.5 -Python 3.3 ___ Python tracker

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2014-01-05 Thread Martin Panter
Martin Panter added the comment: The Issue 12692 fix has been backported to the 3.3 branch, and it fixes this bug. However here is an updated patch (against revision 28337a8fb502 in the “3.3” branch) consisting of two left over bits you might still want to use: 1. My test case 2. Explicitly c

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2013-12-28 Thread Martin Panter
Martin Panter added the comment: Just discovered the same fix of manually closing the socket object was already made independently of my patch in the “default” branch! See Issue 12692. http://hg.python.org/cpython/rev/92656b5df2f2 The main difference is my patch should also close the connectio

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2013-12-21 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2013-12-19 Thread Martin Panter
Martin Panter added the comment: How is it safer to manually set “h.sock._closed”? Playing with the internals of HTTPConnection is one thing, but playing with the internals of the socket object as well does not seem necessary. Also the ResourceWarning is warning that the socket and connection

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2013-12-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you Martin for clarification. Now I see the problem. Here is regenerated for Rietveld patch. Perhaps more safe will be not close socket, but only set the _closed attribute so that it will be closed just after closing SocketIO. if h.sock:

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2013-12-17 Thread Martin Panter
Martin Panter added the comment: Thanks for looking at this. Perhaps you weren’t pasting the HTTP response into “socat”. After the six request lines are printed out, I enter the five lines between and ; I didn’t really make this obvious. Otherwise, urlopen() hangs waiting for the response and

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2013-12-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I can't reproduce issue. Python just hangs on read() when socat is used as test server. Perhaps I do something wrong. -- nosy: +orsenthil, serhiy.storchaka stage: -> patch review versions: +Python 3.4 -Python 3.2

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2013-12-06 Thread Martin Panter
Changes by Martin Panter : Added file: http://bugs.python.org/file33005/urlopen-sock-close.diff ___ Python tracker ___ ___ Python-bugs-list ma

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2013-12-06 Thread Martin Panter
Martin Panter added the comment: Here are two patches: a test case, and a fix for my issue. They were done against an installed version of Python 3.3.3. I’m not entirely happy with the fix because it is accessing the private HTTPConnection.sock attribute from the urllib.request module, which s

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2013-11-08 Thread Barry A. Warsaw
Changes by Barry A. Warsaw : -- nosy: +barry ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2013-11-07 Thread Martin Panter
New submission from Martin Panter: The AbstractHTTPHandler.do_open() method creates a HTTPConnection object but does not save it anywhere. This means a ResourceWarning is eventually triggered, at least when the HTTP server leaves the the connection open. Demonstration code: from urllib.reques