This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kristjan.jonsson
Recipients amaury.forgeotdarc, dstanek, kristjan.jonsson, martin.panter, orsenthil, pitrou, serhiy.storchaka
Date 2013-12-30.11:29:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1388402992.45.0.020437243186.issue7464@psf.upfronthosting.co.za>
In-reply-to
Content
No, the socket is actually closed when response's close() method is called.  The problem is that the HTTPResponse object, buried deep within the nested classes returned from do_open(), has a circular reference, and _it_ will not go away.

No one is _relying_ on garbage collection in the sense that this is not, I think, designed behaviour, merely an unintentional effect of storing a bound method in the object inance.

As always, circular reference should be avoided when possible since relying on gc is not something to be done lightly.

Now, I think that changing the complicated wrapping at this stage is not possible, but merely replacing the bound method with a weak method might just do the trick.
History
Date User Action Args
2013-12-30 11:29:52kristjan.jonssonsetrecipients: + kristjan.jonsson, amaury.forgeotdarc, orsenthil, pitrou, dstanek, martin.panter, serhiy.storchaka
2013-12-30 11:29:52kristjan.jonssonsetmessageid: <1388402992.45.0.020437243186.issue7464@psf.upfronthosting.co.za>
2013-12-30 11:29:52kristjan.jonssonlinkissue7464 messages
2013-12-30 11:29:51kristjan.jonssoncreate